archive

PostGres: Verify if Table Exists

If you need to verify if a table exists in your postgres database, then you could use this code:

db_query("SELECT exists( select * from pg_tables where tablename='xxx' and schemaname='public')");
if ($row['?column?'] == "t")
{
$result_glob = pg_query("SELECT * from xxx");
$flag_glob_exists = TRUE;
}

Comments are closed.