BUG #17515: Change in behaviour of a composite type within a domain

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: dan(dot)kubb(at)gmail(dot)com
Subject: BUG #17515: Change in behaviour of a composite type within a domain
Date: 2022-06-09 20:42:22
Message-ID: 17515-a24737438363aca0@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17515
Logged by: Dan Kubb
Email address: dan(dot)kubb(at)gmail(dot)com
PostgreSQL version: 14.3
Operating system: All
Description:

I noticed a regression in 13.7 and 14.3 in the behaviour of composite types
within a domain. Here is a simplified reproduction:

BEGIN;

-- Create composite type
CREATE TYPE my_composite_type AS (
col1 boolean,
col2 boolean
);

-- Create domain wrapping the composite type
CREATE DOMAIN my_domain AS my_composite_type NOT NULL;

-- Create function to test composite type
CREATE FUNCTION test_my_composite_type()
RETURNS my_composite_type
LANGUAGE sql
AS $$
SELECT (true, true)
$$;

-- Create function to test domain
CREATE FUNCTION test_my_domain()
RETURNS my_domain
LANGUAGE sql
AS $$
SELECT (true, true)
$$;

-- Works on 13.6/14.2 and 13.7/14.3
SELECT test_my_composite_type FROM test_my_composite_type();

-- Works on 13.6/14.2, but pg 13.7/14.3 this returns the error:
-- ERROR: type my_domain is not composite
SELECT test_my_domain FROM test_my_domain();

ROLLBACK;

--

Dan Kubb

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message okano.naoki@fujitsu.com 2022-06-10 05:09:19 RE: BUG #17514: Application with embedded SQL crashes when executing EXEC SQL PREPARE
Previous Message Tom Lane 2022-06-09 17:01:36 Re: BUG #17514: Application with embedded SQL crashes when executing EXEC SQL PREPARE