2023-10-09 10:11-0400 Tom Lane <tgl@sss.pgh.pa.us> wrote: [...]
>Is that function written in old-style (with a string literal for the
>body) or new-style with BEGIN ATOMIC? [...]
It is old-style. I wrote it before PG 14.
>Can you show us the exact DDL definition of both the table and the
>function? [...]
From the output of pg_dump:
CREATE FUNCTION public.event_id_nextval() RETURNS integer
LANGUAGE sql
AS $$
SELECT COALESCE(MAX(event_id) + 1, 1) FROM event;
$$;
CREATE TABLE public.event (
event_id integer DEFAULT public.event_id_nextval() NOT NULL,
date_start date NOT NULL,
date_end date NOT NULL,
title text NOT NULL,
CONSTRAINT date_end_gt_date_start CHECK ((date_end >= date_start))
);
ALTER TABLE ONLY public.event
ADD CONSTRAINT event_pkey PRIMARY KEY (event_id);
Regards,
Liam