Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msqldump writes unescaped timestamp values when using inserts #6295

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

msqldump writes unescaped timestamp values when using inserts #6295

monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2017-04-24 22:14:04 +0200
From: Leon Helwerda <<l.s.helwerda>>
To: clients devs <>
Version: 11.25.15 (Dec2016-SP3)
CC: @kutsurak

Last updated: 2017-05-01 13:44:57 +0200

Comment 25267

Date: 2017-04-24 22:14:04 +0200
From: Leon Helwerda <<l.s.helwerda>>

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0
Build Identifier:

The msqldump command should provide a dump in a format that can be used to repopulate or migrate a database. By default, it uses COPY INTO statements, but for various reasons one can switch to INSERT INTO (reasons could be to import into different DBMS or because the COPY INTO record is too long for loading into memory of a resource-limited server).

For COPY INTO, it does not matter that fields of type TIMESTAMP do not have quotes. However for INSERT INTO these fields must be escaped, otherwise the MonetDB query interface rejects the statement.

Reproducible: Always

Steps to Reproduce:

$ monetdb create test
$ monetdb release test
$ monetdb start test
$ mclient -u monetdb -d test
sql>CREATE TABLE events(id INTEGER, start TIMESTAMP);
sql>INSERT INTO events VALUES (1, '2017-01-01 00:00:00'), (2, '2017-02-05 12:34:56');
sql>\q
$ msqldump -u monetdb -d test -N -t events > events.sql
$ cat events.sql
-- msqldump dump table events
-- MonetDB v11.25.15 (Dec2016-SP3), 'mapi:monetdb://localhost:50000/test'
CREATE TABLE "sys"."events" (
"id" INTEGER,
"start" TIMESTAMP
);
INSERT INTO "sys"."events" VALUES (1, 2017-01-01 00:00:00.000000);
INSERT INTO "sys"."events" VALUES (2, 2017-02-05 12:34:56.000000);
$ mclient -u monetdb -d test -s 'DROP TABLE events'
$ mclient -u monetdb -d test events.sql

Actual Results:

operation successful
syntax error, unexpected sqlINT, expecting ')' or ',' in: "insert into "sys"."events" values (1, 2017-01-01 00"
syntax error, unexpected sqlINT, expecting ')' or ',' in: "insert into "sys"."events" values (2, 2017-02-05 12"

The table is created but is not populated from the entries in the dump.

Expected Results:

The table imports all rows of the dumped table, like the variant with COPY INTO does (by not passing -N to msqldump).

Comment 25268

Date: 2017-04-25 10:20:31 +0200
From: MonetDB Mercurial Repository <>

Changeset b9f673db5b0e made by Panagiotis Koutsourakis kutsurak@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=b9f673db5b0e

Changeset description:

Properly quote time stamps when dumping db

This fixes bug #6295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant