pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14448: create table as values - type check skipped
2+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2016-12-08 0b78106cd4 cf22c8cb89 6a493adda7 c7a62135ac 2afe282a37 082d1fb9e4  Fix reporting of column typmods for multi-row VALUES constructs.
* BUG #14448: create table as values - type check skipped
@ 2016-12-05 14:30  hmahmood89@googlemail.com
  0 siblings, 1 reply; 2+ messages in thread

From: hmahmood89@googlemail.com @ 2016-12-05 14:30 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14448
Logged by:          Hassan Mahmood
Email address:      hmahmood89@googlemail.com
PostgreSQL version: 9.6.1
Operating system:   Windows 7x64
Description:        

drop table if exists product_codes;
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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14448: create table as values - type check skipped
@ 2016-12-05 18:27  Tom Lane <tgl@sss.pgh.pa.us>
  parent: hmahmood89@googlemail.com
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2016-12-05 18:27 UTC (permalink / raw)
  To: hmahmood89@googlemail.com; +Cc: pgsql-bugs

hmahmood89@googlemail.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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-12-05 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-12-05 14:30 BUG #14448: create table as values - type check skipped hmahmood89@googlemail.com
2016-12-05 18:27 ` Tom Lane <tgl@sss.pgh.pa.us>

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