Re: sql function with empty row

2018-05-16 Thread Laurenz Albe
Philipp Kraus wrote: > I have defined a SQL function > > CREATE OR REPLACE FUNCTION substancetrivialname(text) > RETURNS substance > LANGUAGE 'sql' > COST 100 > VOLATILE > AS $BODY$ > select s.* from substancetrivialname n > join substance s on s.id = n.idsubstance > w

Re: sql function with empty row

2018-05-16 Thread David G. Johnston
On Wed, May 16, 2018 at 11:49 AM, Philipp Kraus < philipp.kr...@tu-clausthal.de> wrote: > I have tested it on my data and it works also, but that is a little bit > confusing, because imho setof is >= 0 rows and > without setof it is [0,1]. ​Without setof it will always return exactly 1 row, neve

Re: sql function with empty row

2018-05-16 Thread Adrian Klaver
On 05/16/2018 11:49 AM, Philipp Kraus wrote: Am 16.05.2018 um 20:40 schrieb Adrian Klaver : I have tested it on my data and it works also, but that is a little bit confusing, because imho setof is >= 0 rows and without setof it is [0,1]. On this I know there exist only one or no record, s

Re: sql function with empty row

2018-05-16 Thread Philipp Kraus
> Am 16.05.2018 um 20:40 schrieb Adrian Klaver : > > On 05/16/2018 11:07 AM, Philipp Kraus wrote: >> Hello, >> I have defined a SQL function >> CREATE OR REPLACE FUNCTION substancetrivialname(text) >> RETURNS substance >> LANGUAGE 'sql' >> COST 100 >> VOLATILE >> AS $BODY$ >> sele

Re: sql function with empty row

2018-05-16 Thread Adrian Klaver
On 05/16/2018 11:07 AM, Philipp Kraus wrote: Hello, I have defined a SQL function CREATE OR REPLACE FUNCTION substancetrivialname(text) RETURNS substance LANGUAGE 'sql' COST 100 VOLATILE AS $BODY$ select s.* from substancetrivialname n join substance s on s.id = n.idsub

Re: sql function with empty row

2018-05-16 Thread Melvin Davidson
On Wed, May 16, 2018 at 2:25 PM, Adrian Klaver wrote: > On 05/16/2018 11:07 AM, Philipp Kraus wrote: > >> Hello, >> >> I have defined a SQL function >> >> CREATE OR REPLACE FUNCTION substancetrivialname(text) >> RETURNS substance >> LANGUAGE 'sql' >> COST 100 >> VOLATILE >> AS

Re: sql function with empty row

2018-05-16 Thread Adrian Klaver
On 05/16/2018 11:07 AM, Philipp Kraus wrote: Hello, I have defined a SQL function CREATE OR REPLACE FUNCTION substancetrivialname(text) RETURNS substance LANGUAGE 'sql' COST 100 VOLATILE AS $BODY$ select s.* from substancetrivialname n join substance s on s.id = n.idsub

Re: sql function with empty row

2018-05-16 Thread Adrian Klaver
On 05/16/2018 11:07 AM, Philipp Kraus wrote: Hello, I have defined a SQL function CREATE OR REPLACE FUNCTION substancetrivialname(text) RETURNS substance LANGUAGE 'sql' COST 100 VOLATILE AS $BODY$ select s.* from substancetrivialname n join substance s on s.id = n.idsub