pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: question on plpgsql block
Date: Fri, 13 Apr 2007 08:28:39 +0200
Message-ID: <20070413062839.GB24558@a-kretschmer.de> (raw)
In-Reply-To: <BAY131-W19843640CD2CBC297E50AAB05E0@phx.gbl>
References: <BAY131-W19843640CD2CBC297E50AAB05E0@phx.gbl>

am  Thu, dem 12.04.2007, um 15:44:19 -0700 mailte Karthikeyan Sundaram folgendes:
> Hi Gurus,
>  
>     I tried a plpgsql block from the php.
>  
>     example
>  
>     a='begin
>       insert into table a values (....);
>       insert into table b values (....)
>      insert into table c values (...)
>      select into p_var ... from table where condtion
>      update a set column = <new value> where condition;
>     commit;
>     end;';
>    
>     I works fine when I call this block from php, whereas, I tried to copy the
> same value from the command line prompt or PGadmin GUI utility.  Then it says
> "ERROR:  current transaction is aborted, commands ignored until end of
> transaction block"
>  
>   Why?

My guess:

PHP treat each line separately and sends line by line to the server and
adds the missing ';' if necessary.

If you send this from the GUI the server received one big command with
syntax-errors, because the missing ';' after some commands.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net



view thread (3+ messages)

Message-ID: <20070413062839.GB24558@a-kretschmer.de>
Permalink:  ../20070413062839.GB24558@a-kretschmer.de/
Also on:    postgresql.org/message-id/20070413062839.GB24558@a-kretschmer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andreas.kretschmer@schollglas.com
  Subject: Re: question on plpgsql block
  In-Reply-To: <20070413062839.GB24558@a-kretschmer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox