Re: Prompt User From a pgplsql Function - Mailing list pgsql-general

From Tom Lane
Subject Re: Prompt User From a pgplsql Function
Date
Msg-id 3868.1107014960@sss.pgh.pa.us
Whole thread Raw
In response to Prompt User From a pgplsql Function  (Terry Lee Tucker <terry@esc1.com>)
Responses Re: Prompt User From a pgplsql Function  (Terry Lee Tucker <terry@esc1.com>)
List pgsql-general
Terry Lee Tucker <terry@esc1.com> writes:
> Is there any way to gather input from a user while in the
> middle of a transaction from a plpgsql function?

Hmm ... RAISE NOTICE to send out the prompt, and then COPY from some
pre-agreed file to collect the result?  (COPY FROM STDIN would be nicer
but it doesn't work inside plpgsql, and probably can't be made to work
without breaking the FE/BE protocol.)  Seems messy and insecure,
not to mention it requires the client code to be on the same machine
as the database.  I think you'd be better off spending the time to
restructure your functions, instead.

If you were using one of the untrusted languages (plperlu etc) it might
be possible to create a temporary side communication channel to talk to
the client code, but that seems pretty messy as well.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [pgsql-advocacy] MySQL worm attacks Windows servers
Next
From: Sven Willenberger
Date:
Subject: Re: Moving from Sybase to Postgres - Stored Procedures