Skip site navigation (1) Skip section navigation (2)

Dblink vs calling a function that returns void

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Dblink vs calling a function that returns void
Date: 2010-03-29 15:48:51
Message-ID: 4BB0CBE3.8070508@cybertec.at (view raw or flat)
Thread:
Lists: pgsql-general
Hi,

I need to call a function via dblink that returns a void, i.e.
technically nothing.

=# select public.dblink_exec('import', 'SELECT
import.add_one_word(''word'', true)');
ERROR:  statement returning results not allowed

=# select * from public.dblink('import', 'SELECT
import.add_one_word(''word'', true)') as x();
ERROR:  syntax error at or near ")"
LINE 1: ...ort', 'SELECT import.add_one_word(''iphon'', true)') as x();

=# select public.dblink('import', 'SELECT import.add_one_word(''word'',
true)') as x(x void);
ERROR:  syntax error at or near "("
LINE 1: ...'SELECT import.add_one_word(''iphon'', true)') as x(x void);

And, although RETURNS VOID is indistinguishable from returning a NULL:

=# select * from public.dblink('import', 'SELECT
import.add_one_word(''word'', true)') as x(x int);
ERROR:  invalid input syntax for integer: ""

So, how can I do it? Besides modifying the interface of the function,
say "RETURNS int4" and using PG_RETURN_NULL()?

Best regards,
Zoltán Böszörményi

-- 
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/


Responses

pgsql-general by date

Next:From: 赤松 建司Date: 2010-03-29 15:50:37
Subject:
Previous:From: AndrusDate: 2010-03-29 15:47:23
Subject: Re: ***SPAM*** Re: Splitting text column to multiple rows

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group