From: | Lee Keel <lee(dot)keel(at)uai(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | tables not in list |
Date: | 2007-07-30 19:31:10 |
Message-ID: | 76758090F8686C47A44B6FF52514A1D308C9C6A9@hermes.uai.int |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi List,
I have a list of table names and I am trying to confirm that they are all in
my postgres db. But what I want returned is a list/array of ones that are
in my list but not in the db. So for example:
CREATE TABLE test
(
somecol integer
) WITHOUT OIDS;
CREATE TABLE bar
(
barcol integer
) WITHOUT OIDS;
Now if I were to have a list of table names that included 'test', 'bar', and
'foo', then how do I get 'foo' to return. Here is what I have, but it
returns the ones that are in the list and I want the opposite of that.
select array(
select table_name::text from information_schema.tables where
table_catalog='postgres' and table_type='BASE TABLE' and
table_schema='public'
and table_name = any (array['test', 'bar', 'foo']))
Thanks in advance for any help on this.
Lee
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
From | Date | Subject | |
---|---|---|---|
Next Message | paddy carroll | 2007-07-30 20:24:20 | Re: tables not in list |
Previous Message | Cultural Sublimation | 2007-07-30 18:21:00 | Re: Optimising SELECT on a table with one million rows |