On 3/22/25 17:31, Igor Korot wrote:
Hi, All,
I have a big script that populated the DB for me.
The language used for the script?
Is it actually running in psql?
I made it based on the latest available version.
However, i have version 13 installed on my Linux box and so trying to
execute
On 3/23/25 10:38, Igor Korot wrote:
Hi, Tom,
2 things, however.
1. Apparently CREATE OR RELACE TRIGGER syntax is available since v17,
which is the current one. So I hadto adjust the numbers.. 😀
Really?:
https://www.postgresql.org/docs/14/sql-createtrigger.html
"CREATE [ OR REPLACE ] [
Hi,
[code]
SELECT current_setting('server_version_num')::int > 13 as v13
\gset
\if :v13
CREATE OR REPLACE TRIGGER playersinleague_insert AFTER INSERT ON
playersinleague WHEN new.current_rank IS NULL
BEGIN
UPDATE playersinleague SET current_rank = 1 + (SELECT
coalesce( max( cur
On Sunday, March 23, 2025, Igor Korot wrote:
>
> 2. Is there a way to do CREATE TRIGGER IF NOT EXIST for the earlier
> version?
>
No. You have to drop the trigger if it does exist and then create the new
one.
David J.
On Sunday, March 23, 2025, David G. Johnston
wrote:
> On Sunday, March 23, 2025, Igor Korot wrote:
>
>>
>> 2. Is there a way to do CREATE TRIGGER IF NOT EXIST for the earlier
>> version?
>>
>
> No. You have to drop the trigger if it does exist and then create the new
> one.
>
Well, you can alw
Hi
ne 23. 3. 2025 v 19:31 odesílatel Igor Korot napsal:
> Hi,
>
> [code]
> SELECT current_setting('server_version_num')::int > 13 as v13
> \gset
> \if :v13
>CREATE OR REPLACE TRIGGER playersinleague_insert AFTER INSERT ON
> playersinleague WHEN new.current_rank IS NULL
>BEGIN
>
On Sunday, March 23, 2025, Igor Korot wrote:
>
> CREATE TRIGGER playersinleague_insert AFTER INSERT ON playersinleague
> WHEN new.current_rank IS NULL
>
>
When the syntax shows parentheses you are required to write them.
[ WHEN ( *condition* ) ]
David J.
Hi, Tom,
On Sat, Mar 22, 2025, 10:01 PM Tom Lane wrote:
> Igor Korot writes:
> > On Sat, Mar 22, 2025, 8:58 PM David G. Johnston <
> david.g.johns...@gmail.com>
> > wrote:
> >> Then read the psql docs. Your version has \if and you’ll find server
> >> version listed as the available client va
> On Mar 23, 2025, at 18:08, Igor Korot wrote:
> CREATE TRIGGER playersinleague_insert AFTER INSERT ON playersinleague
> WHEN new.current_rank IS NULL
The WHEN predicate has to be enclosed in parenthes:
CREATE TRIGGER playersinleague_insert AFTER INSERT ON playersinleague
WHEN (
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( curre
On Sunday, March 23, 2025, Pavel Stehule wrote:
> Hi
>
> ne 23. 3. 2025 v 19:31 odesílatel Igor Korot napsal:
>
>> Hi,
>>
>> [code]
>> SELECT current_setting('server_version_num')::int > 13 as v13
>>
>
> SELECT current_setting('server_version_num')::int > =14 as v14
>
IOW, you can’t us
Igor Korot writes:
> On Sat, Mar 22, 2025, 8:58 PM David G. Johnston
> wrote:
>> Then read the psql docs. Your version has \if and you’ll find server
>> version listed as the available client variables.
> I was hoping for something like
> If server_version >= X:
> CREATE OR REPLACE TRIGGE
Hi, David,
On Sat, Mar 22, 2025, 8:58 PM David G. Johnston
wrote:
> On Saturday, March 22, 2025, Igor Korot wrote:
>
>>
>>
>>> Is it actually running in psql?
>>>
>>
>> Yes, i run "psql - d draft -a -f
>>
>
> Then read the psql docs. Your version has \if and you’ll find server
> version liste
On Saturday, March 22, 2025, Igor Korot wrote:
>
>
>> Is it actually running in psql?
>>
>
> Yes, i run "psql - d draft -a -f
>
Then read the psql docs. Your version has \if and you’ll find server
version listed as the available client variables.
David J.
Hi, Adrian,
On Sat, Mar 22, 2025, 7:42 PM Adrian Klaver
wrote:
> On 3/22/25 17:31, Igor Korot wrote:
> > Hi, All,
> > I have a big script that populated the DB for me.
>
> The language used for the script?
>
What do you mean?
Its just a text file with bunch of create table/insert into
> Is it
Adrian Klaver writes:
> On 3/22/25 17:31, Igor Korot wrote:
>> Is there a way to determine the server version from such a script?
> show server_version_num;
psql already populates its SERVER_VERSION_NUM variable from that
for you.
regards, tom lane
16 matches
Mail list logo