From: | kes-kes(at)yandex(dot)ru |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #14164: Postgres allow to insert more data into field than this field allow |
Date: | 2016-05-30 08:50:41 |
Message-ID: | 20160530085041.19432.93208@wrigleys.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: 14164
Logged by: Eugen Konkov
Email address: kes-kes(at)yandex(dot)ru
PostgreSQL version: 9.5.2
Operating system: x86_64-pc-linux-gnu, (Ubuntu 4.8.2-19ubuntu1) 64bi
Description:
# \d+ files2_102009; Table
"public.files2_102009"
Column | Type | Modifiers
| Storage | Stats target | Description
-------------+-----------------------------+----------------------------------------+----------+--------------+-------------
filename | character varying(255) | default NULL::character varying
| extended | |
# select filename from files2_102009 where id = '057cbd75c160a38e';
filename
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
20-%D0%A1%D0%B2%D0%B8%D0%BD%D0%BD%D0%B0%D1%8F%20%D1%80%D1%83%D0%BB%D1%8C%D0%BA%D0%B0%28%D0%A1%D0%B2%D0%B8%D0%BD%D0%B8%D0%BD%D0%B0%2C%20%D0%BA%D0%B5%D0%B4%D1%80%D0%BE%D0%B2%D1%8B%D0%B9%20%D0%BE%D1%80%D0%B5%D1%85%2C%20%D1%81%D0%BE%D1%83%D1%81%29620%D1%80.jpg
(1 row)
How to reproduce:
We need mysql server, mysql_fdw, postgres;
1) create mysql table:
CREATE TABLE `files2` (
...
`filename` text
);
2) create extension mysql_fdw and foreign table:
# \d+ files2_mysql
Foreign table "public.files2_mysql"
Column | Type | Modifiers
| FDW Options | Storage | Stats target | Description
...
filename | character varying(255) | default NULL::character varying
| | extended | |
3) create postgres table:
# \d+ files2_102009; Table
"public.files2_102009"
Column | Type | Modifiers
| Storage | Stats target | Description
-------------+-----------------------------+----------------------------------------+----------+--------------+-------------
filename | character varying(255) | default NULL::character varying
| extended | |
4)
INSERT INTO files2_102009 SELECT * FROM files2_mysql;
Because of type of column of source and destination tables are equal
postgres does not check actual data so very long data at text field of mysql
database is inserted into limited field at postgres DB.
EXPECTED: postgres should not allow to insert into field more data than
field allows.
From | Date | Subject | |
---|---|---|---|
Next Message | mtmayr | 2016-05-30 14:02:40 | BUG #14165: jdbc driver version 9.4 |
Previous Message | Daniel Migowski | 2016-05-30 07:56:46 | Re: BUG #14162: No statistics for functions used as aggregates |