David G. Johnston david.g.johns...@gmail.com writes:
I know this could be written quite easily in sql but was wondering if it is
possible in pl/pgsql.
CREATE FUNCTION test_func()
RETURNS text
LANGUAGE 'plpgsql'
AS $$
BEGIN
SELECT 'text_to_return' INTO what_goes_here?; --with or without a
On Sat, Jun 20, 2015 at 10:56 AM, Tom Lane t...@sss.pgh.pa.us wrote:
David G. Johnston david.g.johns...@gmail.com writes:
I know this could be written quite easily in sql but was wondering if it
is
possible in pl/pgsql.
CREATE FUNCTION test_func()
RETURNS text
LANGUAGE 'plpgsql'
AS
David G. Johnston david.g.johns...@gmail.com writes:
On Sat, Jun 20, 2015 at 10:56 AM, Tom Lane t...@sss.pgh.pa.us wrote:
David G. Johnston david.g.johns...@gmail.com writes:
I know this could be written quite easily in sql but was wondering if
it is
possible in pl/pgsql.
Hello
The solution proposed by Tom works as long as you can make sure that
your SELECT statement in the function will return a single row with a
single column of type TEXT:
CREATE TABLE test (id INTEGER, what_goes_here TEXT);
INSERT INTO test values (1,'Text 1');
INSERT INTO test values