pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
question on plpgsql block
3+ messages / 3 participants
[nested] [flat]

* question on plpgsql block
@ 2007-04-12 22:44 Karthikeyan Sundaram <skarthi98@hotmail.com>
  2007-04-12 23:38 ` Re: question on plpgsql block Peter Eisentraut <peter_e@gmx.net>
  2007-04-13 06:28 ` Re: question on plpgsql block A. Kretschmer <andreas.kretschmer@schollglas.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Karthikeyan Sundaram @ 2007-04-12 22:44 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org; pgsql-sql


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?
 
   Did we need to do any special step up to execute a block or blocks won't execue from command line mode? Please advise.
 
Regards
skarthi
 
 
 
_________________________________________________________________
Your friends are close to you. Keep them that way.
http://spaces.live.com/signup.aspx=

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: question on plpgsql block
  2007-04-12 22:44 question on plpgsql block Karthikeyan Sundaram <skarthi98@hotmail.com>
@ 2007-04-12 23:38 ` Peter Eisentraut <peter_e@gmx.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2007-04-12 23:38 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org; +Cc: Karthikeyan Sundaram <skarthi98@hotmail.com>

Karthikeyan Sundaram wrote:
>     I tried a plpgsql block from the php.

plpgsql blocks only work in a plpgsql function.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: question on plpgsql block
  2007-04-12 22:44 question on plpgsql block Karthikeyan Sundaram <skarthi98@hotmail.com>
@ 2007-04-13 06:28 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
  1 sibling, 0 replies; 3+ messages in thread

From: A. Kretschmer @ 2007-04-13 06:28 UTC (permalink / raw)
  To: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-04-13 06:28 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-04-12 22:44 question on plpgsql block Karthikeyan Sundaram <skarthi98@hotmail.com>
2007-04-12 23:38 ` Peter Eisentraut <peter_e@gmx.net>
2007-04-13 06:28 ` A. Kretschmer <andreas.kretschmer@schollglas.com>

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