Page 1 of 1

TableExists and PostgresSql

Posted: 04.02.2011, 17:16
by tintinux
Hi

With PgSql 8.4, Lazarus 0.28, TableExists returns to me always FALSE even when the table exists.

With MySql 5, and the same code, it works fine.

I have also tried GetTableNames, but it returns only meta-table from the catalog postgres database, and no table from the currently connected database. This can explain the initial issue...

Is it known, or what could I do to make it working ?

Maybe a SELECT expression could give me the right result. I did it with MySql before I discovered the Exists function, but I'm new to pgSql and don't find the exact database and table to query with it.

Thanks for your help !

Tintinux

Posted: 06.02.2011, 16:37
by Wild_Pointer
hello tintinux,

would you please provide the code sample how you try to obtain the tablenames?...

I tried

Code: Select all

  ZConnection1.Connect;
  ZConnection1.GetTableNames('', 'public', Memo1.Lines);
  ZConnection1.Disconnect; 
It provided me the tables of the public schema. I use Lazarus 0.9.28.2-10ubuntu1 FPC 2.4.0 i386-linux-gtk 2 (beta). Zeos lib v7.

Posted: 06.02.2011, 18:50
by tintinux
Hi

Thanks for your help.

With the parameter public in GetTableNames, I can see all tables I'm searching for.
I'm not used to postgres and didn't knew it was necessary for this DBMS (it is not with MySql)...

Best regards

Tintinux