public inbox for [email protected]
help / color / mirror / Atom feedFrom: Igor Korot <[email protected]>
To: David G. Johnston <[email protected]>
Cc: Pavel Stehule <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Adrian Klaver <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: Determine server version from psql script
Date: Sun, 23 Mar 2025 20:08:11 -0500
Message-ID: <CA+FnnTyXFh+sXTOC7HMU0eLDmW0YLhWjX+Z89V9uzg5gtFcHLQ@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwZ1=Mi_w-Wt4AkOSO1M+CD-Tg-W7O+9rJb-Fp7Q884fHQ@mail.gmail.com>
References: <CA+FnnTyWEsYi=_QTeSXoGXd7Fkd8C7_AnCc5=hho-DZF9_iunQ@mail.gmail.com>
<[email protected]>
<CA+FnnTz9-cjBDf3mC9fx_FCtZGDTneF9=w8LpTRdwCfxHN86yw@mail.gmail.com>
<CAKFQuwZGjMYbP0nWYb2+-D1a_dNg6b-mDhDC96Am-c2MZOYTNw@mail.gmail.com>
<CA+FnnTy2Lk+K8t2uKwc1cAnCm6+RTb72eVRxt9+Y8y+C=sUeyA@mail.gmail.com>
<[email protected]>
<CA+FnnTztyXpMxEiKTZhxMtcQ8Nm6D+M1jbfJFfkJYU9dyvTeLg@mail.gmail.com>
<CAKFQuwZ3-wmpyUEdHUaL7H9RHp-FTxUJjVL3L5A0jqA2bbHXYw@mail.gmail.com>
<CAKFQuwb6vf1L2O8X_6Qu2VNq9iUhCjbXTc=51702h7yo4dH=8w@mail.gmail.com>
<CA+FnnTx5n=yCw4+qcRuv-c7ECf=K=tao7j_k=dDp5nPUMJ7t_A@mail.gmail.com>
<CAFj8pRB5d=0WQYyK7Nho7XY2qY+rvgwzqSmWpVOYBdvC9dcDXw@mail.gmail.com>
<CAKFQuwZ1=Mi_w-Wt4AkOSO1M+CD-Tg-W7O+9rJb-Fp7Q884fHQ@mail.gmail.com>
Hi,
This is what :
[code[
\else
DROP TRIGGER IF EXISTS playersinleague_insert ON playersinleague;
CREATE TRIGGER playersinleague_insert AFTER INSERT ON playersinleague
WHEN new.current_rank IS NULL
BEGIN
UPDATE playersinleague SET current_rank = 1 + (SELECT coalesce(
max( current_rank ), 0 ) FROM playersinleague WHERE id = new.id) WHERE
rowid = NEW.rowid;
UPDATE playersinleague SET original_rank = current_rank WHERE rowid
= new.rowid;
END;
\endif
[/code]
And I'm getting this:
[code]
\else
DROP TRIGGER IF EXISTS playersinleague_insert ON playersinleague;
psql:draft_pg.sql:44269: NOTICE: trigger "playersinleague_insert" for
relation "playersinleague" does not exist, skipping
DROP TRIGGER
CREATE TRIGGER playersinleague_insert AFTER INSERT ON playersinleague
WHEN new.current_rank IS NULL
BEGIN
UPDATE playersinleague SET current_rank = 1 + (SELECT coalesce(
max( current_rank ), 0 ) FROM playersinleague WHERE id = new.id) WHERE
rowid = new.rowid;
psql:draft_pg.sql:44272: ERROR: syntax error at or near "new"
LINE 1: ...eague_insert AFTER INSERT ON playersinleague WHEN new.curren...
^
[/code]
What is the problem niw?
Thank you.
On Sun, Mar 23, 2025 at 2:27 PM David G. Johnston <
[email protected]> wrote:
>
> On Sunday, March 23, 2025, Pavel Stehule <[email protected]> wrote:
>>
>> Hi
>>
>> ne 23. 3. 2025 v 19:31 odesílatel Igor Korot <[email protected]> napsal:
>>>
>>> Hi,
>>>
>>> [code]
>>> SELECT current_setting('server_version_num')::int > 130000 as v13
>
>
>>
>> SELECT current_setting('server_version_num')::int > =140000 as v14
>
>
> IOW, you can’t use >130000 because that will match v13.1 which is 130001
in integer format.
>
> David J.
>
view thread (14+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Determine server version from psql script
In-Reply-To: <CA+FnnTyXFh+sXTOC7HMU0eLDmW0YLhWjX+Z89V9uzg5gtFcHLQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox