From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | sundar(at)mudupalli(dot)com |
Subject: | BUG #18962: Type Conversion incorrect when performing UNION of queries. |
Date: | 2025-06-19 12:21:15 |
Message-ID: | 18962-71e1ca655df5139f@postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 18962
Logged by: Sundar Mudupalli
Email address: sundar(at)mudupalli(dot)com
PostgreSQL version: 17.5
Operating system: Ubuntu I believe (using a Cloud SQL instance in GC
Description:
Take the following table definitions:
```
create table public.test_table_1 as
SELECT
'AA'::character(2) AS text_type
UNION ALL
SELECT
'BB'::character(2) AS text_type
UNION ALL
SELECT
'CC'::TEXT AS text_type
;
create table public.test_table_2 (
char_fixed character,
char_fixed_len character(5),
char_var character varying(5),
text_column text );
```
Based on the [type conversion rules for
Union](https://www.postgresql.org/docs/current/typeconv-union-case.html),
the column `text_type` in `test_table_1` should resolve to the postgres data
type `TEXT`. However running the following query produces the following:
```
select table_name, column_name, data_type, character_maximum_length from
information_schema.columns where table_name like 'test_table_%' order by
table_name;
table_name | column_name | data_type |
character_maximum_length
--------------+----------------+-------------------+--------------------------
test_table_1 | text_type | character |
test_table_2 | char_fixed | character |
1
test_table_2 | char_fixed_len | character |
5
test_table_2 | char_var | character varying |
5
test_table_2 | text_column | text |
(5 rows)
```
The data type for text says `character` (fixed length character string) of
undetermined length, when it should really be of type `text` as the column
`text_column` in `test_table_2`.
From | Date | Subject | |
---|---|---|---|
Next Message | Chrzan, Maximilian | 2025-06-19 14:08:34 | AW: [EXTERNAL] Re: BUG #18959: Name collisions of expression indexes during parallel Index creations on a pratitioned table. |
Previous Message | Ashutosh Bapat | 2025-06-19 08:47:40 | Re: "unexpected duplicate for tablespace" problem in logical replication |