Re: tables not in list

Поиск
Список
Период
Сортировка
От Viatcheslav Kalinin
Тема Re: tables not in list
Дата
Msg-id 46AF4416.90707@ipcb.net
обсуждение исходный текст
Ответ на Re: tables not in list  (Lee Keel <lee.keel@uai.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Lee Keel
Дата:
Сообщение: Re: tables not in list
Следующее
От: Lee Keel
Дата:
Сообщение: Re: tables not in list