Re: BUG #18151: pg_upgradecluster fails when column default refers to column - Mailing list pgsql-bugs

From Liam Morland
Subject Re: BUG #18151: pg_upgradecluster fails when column default refers to column
Date
Msg-id 20231009161305.af4z3fz3cfgo2gwl@burns.morland.ca
Whole thread Raw
In response to Re: BUG #18151: pg_upgradecluster fails when column default refers to column  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #18151: pg_upgradecluster fails when column default refers to column
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18151: pg_upgradecluster fails when column default refers to column
Next
From: Tom Lane
Date:
Subject: Re: BUG #18151: pg_upgradecluster fails when column default refers to column