Using SELECT as DDL/DML statement is wrong (was RE: reinitialize a sequence?)

Поиск
Список
Период
Сортировка
От Edmar Wiggers
Тема Using SELECT as DDL/DML statement is wrong (was RE: reinitialize a sequence?)
Дата
Msg-id NEBBIAKDCDHFGJMLHCKIEENKCBAA.edmar@brasmap.com
обсуждение исходный текст
Ответ на Re: reinitialize a sequence?  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
Список pgsql-sql
If and when stored procedures are supported, there should be some way to
prevent functions called in a SELECT statement to modify the database
(create, insert, etc.).

It is confusing (and wrong IMHO) to use statements like

SELECT setval('tablename_serfield_seq',max(serfield)) FROM tablename;
(which is used to reset a sequence)

That should be done with

EXECUTE procedure(tablename_name,sequence_name);
(not sure if execute is the right keyword)

Yours sincerely,

Edmar Wiggers
BRASMAP Information Systems
+55 48 9960 2752



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

Предыдущее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: reinitialize a sequence?
Следующее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: reinitialize a sequence?