Jan Wieck JanWieck at Yahoo.com
Thu Aug 30 17:15:42 PDT 2007
On 8/30/2007 5:02 PM, Dmitry Koterov wrote:
> Sorry, not quite clearly for me.
> Could you please post an example where a single DLL query is wrong in 
> PostgreSQL 8+?
> 
> You meant that
> 
> "CREATE TABLE a(a INTEGER); ALTER TABLE a ADD COLUMN b INTEGER;"

Yes, this fails if it is executed as a single call to PQexec() because 
the parser tries to create a parsetree list of all queries before 
handing that parsetree list to the planner. It succeeds in psql because 
psql will split this into two separate PQexec() calls.


Jan

> 
> executed as a SINGLE query would fail in postgres?
> 
> On 8/31/07, *Christopher Browne* <cbbrowne at ca.afilias.info 
> <mailto:cbbrowne at ca.afilias.info>> wrote:
> 
> 
>     Perhaps you should reread the release notes, as they explain quite
>     clearly why it is necessary to split the DDL script into multiple
>     statements.
> 
>     To wit, from the release notes for 1.2.0:
> 
>     --------------------------------------------------------------------
>     - DDL scripts are broken into individual statements
> 
>       This is more a bug fix than an enhancement; it now permits DDL
>       scripts to create new tables and columns, and reference them later
>       in the script.
> 
>       In the past, DDL was submitted to the postmaster as a single query,
>       which meant that all of them had to reference the state of
>       pg_catalog as it was before the DDL ran.  So you could add as many
>       columns to tables as you liked; you could NOT, then, reference those
>       columns, because the query processor would discover that the new
>       column didn't exist as at "before the DDL ran."
> 
>       There is now a statement parser which splits scripts into individual
>       SQL statements and passes them to the database back end
>       individually.
>     --------------------------------------------------------------------
>     --
>     (reverse (concatenate 'string "moc.enworbbc" "@" "enworbbc"))
>     http://cbbrowne.com/info/finances.html
>     "What's wrong with 3rd party tools? Especially if they are free?  What
>     the **** do you think Unix is  anyway? It's a big honkin' party of 3rd
>     party free tools." -- Bob Cassidy ( rmcassid at uci.edu
>     <mailto:rmcassid at uci.edu>)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Slony1-general mailing list
> Slony1-general at lists.slony.info
> http://lists.slony.info/mailman/listinfo/slony1-general


-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck at Yahoo.com #


More information about the Slony1-general mailing list