Search Postgresql Archives

Re: Check the existance of temporary table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <BAY133-DAV980F324FFC1159F12BBF7AE680@xxxxxxx>,
Martin Gainty <mgainty@xxxxxxxxxxx> wrote:

% Assuming your schema will be  pg_temp_1

Not a particularly reasonable assumption...

% vi InitialTableDisplayStatements.sql
% select * from pg_tables where pg_namespace = 'pg_temp1';

pmcphee=# select * from pg_tables where schemaname like 'pg_temp%';
 schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers 
------------+-----------+------------+------------+------------+----------+-------------
 pg_temp_2  | x         | pmcphee    | x          | f          | f        | f
(1 row)

pmcphee=# select * from x;
ERROR:  relation "x" does not exist

But the test itself is problematic. I think this query is better.

 select pg_table_is_visible(pg_class.oid)
  from pg_class, pg_namespace
  where relname = 'x' and
	relnamespace = pg_namespace.oid and
	nspname like 'pg_temp%';


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux