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

From: Ralf Schuchardt <rasc(at)gmx(dot)de>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: if not exists (SELECT 1... UNION SELECT 1...)
Date: 2022-02-16 15:44:36
Message-ID: 9F4935D6-F0D0-42BE-B26B-77F72BC74D4B@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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 really happens is:

out_text := '___WRONG___' RETURN;

where „return“ is a simple column name as in this select statement:

select '___WRONG___' return;

Yours,
Ralf

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2022-02-16 16:23:29 Re: if not exists (SELECT 1... UNION SELECT 1...)
Previous Message Alexander Farber 2022-02-16 13:36:23 Re: if not exists (SELECT 1... UNION SELECT 1...)