Re: temp tables ORACLE/PGSQL

Поиск
Список
Период
Сортировка
От Tony Caduto
Тема Re: temp tables ORACLE/PGSQL
Дата
Msg-id 42712822.4080602@amsoftwaredesign.com
обсуждение исходный текст
Ответ на Re: temp tables ORACLE/PGSQL  (Dennis Sacks <dennis@illusions.com>)
Ответы Re: temp tables ORACLE/PGSQL  (Steve Atkins <steve@blighty.com>)
Re: temp tables ORACLE/PGSQL  (Dennis Sacks <dennis@illusions.com>)
Список pgsql-general
This is not entirely correct.   We use temp tables all the time in PLpgsql functions and never have to use
execute.  We have found that you have to use EXECUTE only in certain circumstances.


  stored procedures that use temporary tables are more
> painful to write - you need to use EXECUTE for any SQL that references a
> temporary table - read the Porting From Oracle section of the PostgreSQL
> manual. I'd recommend rereading it several times.

we use this in all our functions that use temp tables, and we use PG Lightning Admin, which refreshes the
connection each time you run a query which gets around a lot of issues with temp tables.

CREATE or REPLACE FUNCTION public.iftableexists( varchar)
RETURNS pg_catalog.bool AS
$BODY$
DECLARE

  BEGIN

      /* check the table exist in database and is visible*/
  perform n.nspname ,c.relname
FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid
= c.relnamespace
where n.nspname like 'pg_temp_%' AND pg_catalog.pg_table_is_visible(c.oid)
AND Upper(relname) = Upper($1);

      IF FOUND THEN
         RETURN TRUE;
      ELSE
         RETURN FALSE;
      END IF;

  END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

--
Tony Caduto
AM Software Design
Home of PG Lightning Admin for Postgresql 8.x
http://www.amsoftwaredesign.com

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

Предыдущее
От: Simon Windsor
Дата:
Сообщение: OT: phpPgAdmin
Следующее
От: Steve Atkins
Дата:
Сообщение: Re: temp tables ORACLE/PGSQL