Re: BUG #18151: pg_upgradecluster fails when column default refers to column

From: Liam Morland <liam(at)morland(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18151: pg_upgradecluster fails when column default refers to column
Date: 2023-10-09 16:13:05
Message-ID: 20231009161305.af4z3fz3cfgo2gwl@burns.morland.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

2023-10-09 10:11-0400 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-10-09 16:42:44 Re: BUG #18151: pg_upgradecluster fails when column default refers to column
Previous Message Tom Lane 2023-10-09 15:03:37 Re: BUG #18151: pg_upgradecluster fails when column default refers to column