TableExists and PostgresSql

Forum related to PostgreSQL

Moderators: gto, cipto_kh, EgonHugeist, olehs

tintinux
Junior Boarder
Junior Boarder
Posts: 41
Joined: 19.05.2010, 10:39

TableExists and PostgresSql

Postby tintinux » 04.02.2011, 17:16

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

Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 159
Joined: 18.03.2008, 13:03
Contact:

Postby Wild_Pointer » 06.02.2011, 16:37

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.

tintinux
Junior Boarder
Junior Boarder
Posts: 41
Joined: 19.05.2010, 10:39

Postby tintinux » 06.02.2011, 18:50

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


Return to “PostgreSQL”

Who is online

Users browsing this forum: No registered users and 1 guest