problem on truncate for v.7.3.2

Поиск
Список
Период
Сортировка
Искать

problem on truncate for v.7.3.2

От:
"jack" <datactrl@tpg.com.au>
Дата:
On version 7.3.2, 'truncate' can not be executed from pl/pgsql. But it isn't
stated on change notes. Is it a bug?

Jack


Re: problem on truncate for v.7.3.2

От:
Josh Berkus <josh@agliodbs.com>
Дата:
Jack,

> On version 7.3.2, 'truncate' can not be executed from pl/pgsql. But it
> isn't stated on change notes. Is it a bug?

No, it's a fix.   

TRUNCATE, VACUUM, ANALYZE, and REINDEX all perform COMMIT statements as part 
of their operation.   If called within a function, this could cause part of 
the function to be committed while the rest failed, or even cause a fatal 
error.   

As such, these statements have been deliberately disabled within PL/pgSQL and 
SQL functions.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

Re: problem on truncate for v.7.3.2

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Josh Berkus  writes:
>> On version 7.3.2, 'truncate' can not be executed from pl/pgsql. But it
>> isn't stated on change notes. Is it a bug?

> No, it's a fix.   

Note however that TRUNCATE has been reimplemented to be transaction-safe
in 7.4, and so the restriction has gone away again.
		regards, tom lane

FAQ