From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: adrien.gilmore+pg@gmail.com
Subject: BUG #17376: Adding unique column with a function() default results in "could not read block 0 in file" error
Date: Fri, 21 Jan 2022 09:22:39 +0000
Message-ID: <17376-07b867ccc817828f@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17376
Logged by: akg
Email address: adrien.gilmore+pg@gmail.com
PostgreSQL version: 13.5
Operating system: Linux
Description:
Hello,
SQL demonstrating the issue on 13.5 is below.
--
BEGIN;
CREATE TABLE t1 (id SERIAL PRIMARY KEY);
INSERT INTO t1 VALUES (default);
CREATE FUNCTION myfunc() RETURNS TEXT LANGUAGE plpgsql AS $$
BEGIN
SELECT r FROM t1;
RETURN random()::text;
END $$;
ALTER TABLE t1 ADD COLUMN r TEXT NOT NULL UNIQUE DEFAULT myfunc();
--
Results in the error:
ERROR: could not read block 0 in file "base/84505/84705": read only 0 of
8192 bytes
The error message content returned is what I suspect of being a bug, not so
much that this SQL didn't work.
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: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, adrien.gilmore+pg@gmail.com
Subject: Re: BUG #17376: Adding unique column with a function() default results in "could not read block 0 in file" error
In-Reply-To: <17376-07b867ccc817828f@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox