Search Postgresql Archives

Re: tables not in list

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

 



> -----Original Message-----
> From: Viatcheslav Kalinin [mailto:vka@xxxxxxxx]
> Sent: Tuesday, July 31, 2007 9:16 AM
> To: Lee Keel
> Cc: pgsql-general@xxxxxxxxxxxxxx
> Subject: Re:  tables not in list
> 
> 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

THANKS!  That was exactly what I needed!
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.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[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