Re: BUG #14448: create table as values - type check skipped

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: hmahmood89(at)googlemail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14448: create table as values - type check skipped
Date: 2016-12-05 18:27:09
Message-ID: 23049.1480962429@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

hmahmood89(at)googlemail(dot)com writes:
> create temporary table product_codes as select *
> from (
> values
> ('abcdefg'::character varying(20)),
> ('012345678901234567ABCDEFGHIJKLMN')
> ) csv_data (product_code);
> select *
> from product_codes;

> I would expect that the type check got applied across all values or that the
> value got truncated.

> The result column states "character varying(20)". Inserts/Updates/Casts all
> truncate as expected.

Hmm. I'm not sure whether that VALUES construct should be expected to
produce varchar(20) or just unrestricted varchar, but I agree that if
it claims to produce varchar(20) then the results should all meet that
limit. Will look into it, thanks for the report!

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-12-05 18:30:39 Re: BUG #14449: inconsistency in behaviour of json/jsonb returning functions for sql NULL and json NULL values
Previous Message rainer.steinmueller 2016-12-05 17:53:54 BUG #14449: inconsistency in behaviour of json/jsonb returning functions for sql NULL and json NULL values