RE: Using SELECT as DDL/DML statement is wrong (was RE: rei nitialize a sequence?)
От | Michael Ansley |
---|---|
Тема | RE: Using SELECT as DDL/DML statement is wrong (was RE: rei nitialize a sequence?) |
Дата | |
Msg-id | 7F124BC48D56D411812500D0B747251480F315@fileserver002.intecsystems.co.uk обсуждение исходный текст |
Ответы |
RE: Using SELECT as DDL/DML statement is wrong (was RE: reinitialize a sequence?)
|
Список | pgsql-sql |
<p><font size="2">In fact, I would have thought that this could be done using</font><p><font size="2">ALTER SEQUENCE sequence_nameSET property = value</font><p><font size="2">But, altering the database in a procedure called from a selectis 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.</font><p><font size="2">Cheers...</font><br /><p><fontsize="2">MikeA</font><br /><br /><p><font size="2">-----Original Message-----</font><br /><font size="2">From:Edmar Wiggers [<a href="mailto:edmar@brasmap.com">mailto:edmar@brasmap.com</a>]</font><br /><font size="2">Sent:05 December 2000 16:50</font><br /><font size="2">To: pgsql-sql@postgresql.org</font><br /><font size="2">Subject:Using SELECT as DDL/DML statement is wrong (was RE: [SQL]</font><br /><font size="2">reinitialize a sequence?)</font><br/><p><font size="2">If and when stored procedures are supported, there should be some way to</font><br/><font size="2">prevent functions called in a SELECT statement to modify the database</font><br /><font size="2">(create,insert, etc.).</font><p><font size="2">It is confusing (and wrong IMHO) to use statements like</font><p><fontsize="2">SELECT setval('tablename_serfield_seq',max(serfield)) FROM tablename;</font><br /><font size="2">(whichis used to reset a sequence)</font><p><font size="2">That should be done with</font><p><font size="2">EXECUTEprocedure(tablename_name,sequence_name);</font><br /><font size="2">(not sure if execute is the right keyword)</font><p><fontsize="2">Yours sincerely,</font><p><font size="2">Edmar Wiggers</font><br /><font size="2">BRASMAPInformation Systems</font><br /><font size="2">+55 48 9960 2752</font><code><font size="3"><br /><br /> **********************************************************************<br/> This email and any files transmitted with itare confidential and<br /> intended solely for the use of the individual or entity to whom they<br /> are addressed. Ifyou have received this email in error please notify<br /> Nick West - Global Infrastructure Manager.<br /><br /> This footnotealso confirms that this email message has been swept by<br /> MIMEsweeper for the presence of computer viruses.<br/><br /> www.mimesweeper.com<br /> **********************************************************************<br /></font></code>
В списке pgsql-sql по дате отправления: