From: kes-kes@yandex.ru
To: pgsql-bugs@postgresql.org
Subject: BUG #14164: Postgres allow to insert more data into field than this field allow
Date: Mon, 30 May 2016 08:50:41 +0000
Message-ID: <20160530085041.19432.93208@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14164
Logged by: Eugen Konkov
Email address: kes-kes@yandex.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.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: kes-kes@yandex.ru
Subject: Re: BUG #14164: Postgres allow to insert more data into field than this field allow
In-Reply-To: <20160530085041.19432.93208@wrigleys.postgresql.org>
References: <20160530085041.19432.93208@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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