Re: if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Laurenz Albe
On Wed, 2022-02-16 at 14:36 +0100, Alexander Farber wrote: > Ah, I have to do > >     RETURN '___WRONG___'; > > and not > >         out_text := '___WRONG___' >         RETURN; Yes. As I said, a trivial error. Yours, Laurenz Albe

Re: if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Alexander Farber
s/grumbling/wondering/

Re: if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Alexander Farber
Ah, thank you Ralf! That has explained it (because I was still grumbling...) On Wed, Feb 16, 2022 at 4:44 PM Ralf Schuchardt wrote: > You must rather end the assignment with a semicolon: > > out_text := '___WRONG___'; > RETURN; > > Otherwise what really happens is: > > out_text := '___WRONG___'

Re: if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Ralf Schuchardt
On 16 Feb 2022, at 14:36, Alexander Farber wrote: > Ah, I have to do > > RETURN '___WRONG___'; Not necessarily. > and not > > out_text := '___WRONG___' > RETURN; You must rather end the assignment with a semicolon: out_text := '___WRONG___'; RETURN; Otherwise what

Re: if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Alexander Farber
Ah, I have to do RETURN '___WRONG___'; and not out_text := '___WRONG___' RETURN;

Re: if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Alexander Farber
Hi Laurenz, thanks for your reply, but I think it is wrong - On Wed, Feb 16, 2022 at 1:24 PM Laurenz Albe wrote: > One reason could be index corruption. If one query uses an index and the > other doesn't, > that could lead to different results. > > The other option is of course a trivial error,

Re: if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Laurenz Albe
On Wed, 2022-02-16 at 11:51 +0100, Alexander Farber wrote: > when I search for a non existent word in the two tables hosted in PostgreSQL > 14.1 then I get zero records as expected: > > words_en=> SELECT 1 FROM words_nouns WHERE word = 'ABCDE' UNION SELECT 1 FROM > words_verbs WHERE word = 'ABCD

if not exists (SELECT 1... UNION SELECT 1...)

2022-02-16 Thread Alexander Farber
Hello, when I search for a non existent word in the two tables hosted in PostgreSQL 14.1 then I get zero records as expected: words_en=> SELECT 1 FROM words_nouns WHERE word = 'ABCDE' UNION SELECT 1 FROM words_verbs WHERE word = 'ABCDE'; ?column? -- (0 rows) But when I try to use the sa