Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
Временные таблички в ХП
|
|||
|---|---|---|---|
|
#18+
Уважаемые коллеги! Пожалуйста подскажите как правильно использовать временные таблички в ХП. А то вообще зарылся что-то. create or replace function test() returns setof integer as ' declare sql text; declare r record; begin execute ''create temporary table tt(id integer);''; perform ''insert into tt values (1);''; for r in execute \'select id from tt\' loop return next r.id; end loop; execute ''drop table tt''; return; end; ' language plpgsql; select * from test(); ** ERROR: relation "tt" already exists CONTEXT: PL/pgSQL function "test" line 4 at execute statement ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.09.2004, 11:06 |
|
||
|
Временные таблички в ХП
|
|||
|---|---|---|---|
|
#18+
Код: plaintext 1. 2. 3. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.09.2004, 12:07 |
|
||
|
Временные таблички в ХП
|
|||
|---|---|---|---|
|
#18+
Заврался, эта проверка на существование таблицы не работает и drop у тебя есть. Код: plaintext 1. 2. 3. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.09.2004, 12:15 |
|
||
|
Временные таблички в ХП
|
|||
|---|---|---|---|
|
#18+
Спасибо за отклик! А каким образом она может быть, если я ее создаю как временную? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.09.2004, 13:38 |
|
||
|
Временные таблички в ХП
|
|||
|---|---|---|---|
|
#18+
В справке на селект предусмотрено: CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ] | table_constraint | LIKE parent_table [ { INCLUDING | EXCLUDING } DEFAULTS ] } [, ... ] ) [ INHERITS ( parent_table [, ... ] ) ] [ WITH OIDS | WITHOUT OIDS ] [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ] где TEMPORARY or TEMP If specified, the table is created as a temporary table. Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction (see ON COMMIT below). Existing permanent tables with the same name are not visible to the current session while the temporary table exists, unless they are referenced with schema-qualified names. ON COMMIT The behavior of temporary tables at the end of a transaction block can be controlled using ON COMMIT. The three options are: PRESERVE ROWS No special action is taken at the ends of transactions. This is the default behavior. DELETE ROWS All rows in the temporary table will be deleted at the end of each transaction block. Essentially, an automatic TRUNCATE is done at each commit. DROP The temporary table will be dropped at the end of the current transaction block. но вот ON COMMIT у меня (работаю из под pgAdmin) вызывает ошибку. В результате (без ON COMMIT), если не отсоединяться, и не дропать таблицу - она остается в отдельной схеме pg_temp_i где i -цифирька. И данные в ей тоже. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.09.2004, 14:34 |
|
||
|
Временные таблички в ХП
|
|||
|---|---|---|---|
|
#18+
Воскрешу темку у меня пострес при вызове процедуры пишет Код: plaintext 1. 2. подскажите пожалуста как с этим бороться пробовал выше описанными методами - не работает. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 22.12.2004, 21:09 |
|
||
|
|

start [/forum/topic.php?fid=53&msg=32718655&tid=2007527]: |
0ms |
get settings: |
6ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
36ms |
get topic data: |
6ms |
get forum data: |
2ms |
get page messages: |
22ms |
get tp. blocked users: |
1ms |
| others: | 225ms |
| total: | 311ms |

| 0 / 0 |
