pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SPI_exec does not return!
2+ messages / 2 participants
[nested] [flat]

* SPI_exec does not return!
@ 2001-07-18 08:10 Markus Wagner <wagner@imsd.uni-mainz.de>
  2001-07-18 10:54 ` Re: SPI_exec does not return! Jan Wieck <JanWieck@Yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Markus Wagner @ 2001-07-18 08:10 UTC (permalink / raw)
  To: pgsql-sql

Hi,

if I do a SELECT on a non-existing table, SPI_exec won't return.
I get, e. g. in pgaccess, an error message "<table> does not exist",
and my code below the function call is never reached.

So why return error codes for SPI_exec when you cannot evaluate them?

The background:

I need to distinguish different client connections within a trigger
function.
To do this, I create a temporary table within a "login" function.
My trigger must check for the existence of this function.
I cannot think of any other method, since there is no "connection id" or
something like that!

This would also be an application for checking the existance of a
temporary table,
as was asked for in another thread in this list before.

How can I check for the existence of a temporary table without getting
interuppted?????

Thanks,

Markus



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

* Re: SPI_exec does not return!
  2001-07-18 08:10 SPI_exec does not return! Markus Wagner <wagner@imsd.uni-mainz.de>
@ 2001-07-18 10:54 ` Jan Wieck <JanWieck@Yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jan Wieck @ 2001-07-18 10:54 UTC (permalink / raw)
  To: Markus Wagner <wagner@imsd.uni-mainz.de>; +Cc: pgsql-sql

Markus Wagner wrote:
> Hi,
>
> if I do a SELECT on a non-existing table, SPI_exec won't return.
> I get, e. g. in pgaccess, an error message "<table> does not exist",
> and my code below the function call is never reached.

    Right,  the  SPI_exec()  call  in  turn  calls the PostgreSQL
    parser and that raises an elog(ERROR) which longjmp()'s  back
    into  the  backends  main  loop  waiting  for the next client
    query.

>
> So why return error codes for SPI_exec when you cannot evaluate them?

    What do you want here? No error,  just  an  empty  result  of
    unspecified  format?   If the parser cannot determine (due to
    nonexistance of a table) which datatype the  columns  of  the
    result  set  at least should have, what else could he do than
    trowing an ERROR?

>
> The background:
>
> I need to distinguish different client connections within a trigger
> function.
> To do this, I create a temporary table within a "login" function.
> My trigger must check for the existence of this function.
> I cannot think of any other method, since there is no "connection id" or
> something like that!

    Unfortunately PL/pgSQL doesn't have global variables.  PL/Tcl
    can  have.   If you cannot code a part of the login mechanism
    in PL/Tcl, setting a global variable and  returning  that  in
    another  PL/Tcl  function, you could create a temp table with
    the same name in every connection and fill the  connection-ID
    into that.


Jan

--

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



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




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


end of thread, other threads:[~2001-07-18 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-18 08:10 SPI_exec does not return! Markus Wagner <wagner@imsd.uni-mainz.de>
2001-07-18 10:54 ` Jan Wieck <JanWieck@Yahoo.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