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

From: Michael Ansley <Michael(dot)Ansley(at)intec-telecom-systems(dot)com>
To: "'Edmar Wiggers'" <edmar(at)brasmap(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: RE: Using SELECT as DDL/DML statement is wrong (was RE: rei nitialize a sequence?)
Date: 2000-12-06 10:19:45
Message-ID: 7F124BC48D56D411812500D0B747251480F315@fileserver002.intecsystems.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

In fact, I would have thought that this could be done using

ALTER SEQUENCE sequence_name SET property = value

But, altering the database in a procedure called from a select is a design
decision, and if somebody wants to do it, well, it's their problem. There
may (on very few occasions, one would hope) actually be some good reasons to
do this.

Cheers...

MikeA

-----Original Message-----
From: Edmar Wiggers [mailto:edmar(at)brasmap(dot)com]
Sent: 05 December 2000 16:50
To: pgsql-sql(at)postgresql(dot)org
Subject: Using SELECT as DDL/DML statement is wrong (was RE: [SQL]
reinitialize a sequence?)

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

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
Nick West - Global Infrastructure Manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Boettcher 2000-12-06 12:01:58 what's wrong with my plperl function?
Previous Message Sivagami . 2000-12-05 22:11:16 Foreign key constraint