Function that creates a custom (temporary) table AND returns a pointer to it = impossible in pg?
В списке pgsql-general по дате отправления:
| От | Davor J. |
|---|---|
| Тема | Function that creates a custom (temporary) table AND returns a pointer to it = impossible in pg? |
| Дата | |
| Msg-id | hl1170$29jn$1@news.hub.org обсуждение |
| Ответы |
Re: Function that creates a custom (temporary) table AND returns a pointer to it = impossible in pg?
|
| Список | pgsql-general |
What I want is something similar to this: CREATE OR REPLACE FUNCTION f( /* "some args..." */) RETURNS text AS $BODY$ DECLARE ... BEGIN DROP TABLE IF EXISTS tbl_temp; CREATE TEMPORARY TABLE tbl_temp( -- "based on args..." ); WHILE INSERT INTO tbl_temp VALUES (/*"some values"*/); END LOOP; /*create indexes on it, manipulate, whatever...*/ RETURN 'tbl_temp'::text; END; $BODY$ LANGUAGE 'plpgsql' Basically, what I want is a similar function f() that returns me a "pointer" to the table which I can use in some query like this: SELECT * FROM regclass(f()); Currently, this query only gives me one row 'tbl_temp'..., but not what I want: "SELECT * FROM tbl_temp;" Can this be done in Postgres? Original post: http://forums.devshed.com/postgresql-help-21/function-that-creates-a-custom-table-and-returns-a-pointer-675539.html Kind regards, Davor
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера