Using SELECT as DDL/DML statement is wrong (was RE: reinitialize a sequence?) - Mailing list pgsql-sql

From Edmar Wiggers
Subject Using SELECT as DDL/DML statement is wrong (was RE: reinitialize a sequence?)
Date
Msg-id NEBBIAKDCDHFGJMLHCKIEENKCBAA.edmar@brasmap.com
Whole thread Raw
In response to Re: reinitialize a sequence?  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
List 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 by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: reinitialize a sequence?
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: reinitialize a sequence?