Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: tables not in list



Lee Keel wrote:
Is there no way to do this without doing an insert into another table?
I usually resolve this as:
-- this function lets you select from an array
CREATE OR REPLACE FUNCTION "array_to_set" (vaarray anyarray) RETURNS SETOF anyelement AS
$body$
BEGIN
FOR I IN COALESCE(ARRAY_LOWER(VAARRAY, 1), 1) .. COALESCE(ARRAY_UPPER(VAARRAY, 1), 0) LOOP
      RETURN NEXT VAARRAY[I];
  END LOOP;
END
$body$
LANGUAGE 'plpgsql';

select table_name
 from array_to_set(array['test', 'bar', 'foo']) as table_name
where table_name not in (select table_name from information_schema.tables where table_catalog='postgres' and table_type='BASE TABLE' and table_schema='public')

regards



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group