question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exporting a table that has a TEXT[] column to SQL creates an invalid SQL insert query

See original GitHub issue

System information:

  • Operating system (distribution) and version
    • Windows 10
  • DBeaver version
    • 7.2.0
  • Additional extensions
    • None

Connection specification:

  • Database name and version
    • PostgreSQL 12.4
  • Driver name
    • PostgreSQL standard driver
  • Do you use tunnels or proxies (SSH, SOCKS, etc)?
    • No

Describe the problem you’re observing:

I tried exporting a table to SQL, and executing the query to insert into another database. The query failed because the array values were malformed.

Steps to reproduce, if exist:

  1. Create a SQL table that has at least 1 column of type TEXT[].
  2. Populate the table with data.
  3. Right click on the table in the Database Navigator, and click Export Data.
  4. Select SQL.
  5. Hit Next until getting to the Output page
  6. Select “Copy to clipboard”
  7. Paste the copied query into a psql prompt

Include any warning/errors/backtraces from the logs

ERROR: malformed array literal: <the array value here>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
serge-ridercommented, Nov 8, 2020

We must put string literals in double quotes in INSERT queries. Fixed

0reactions
kseniiaguzeevacommented, Nov 11, 2020

verified

Read more comments on GitHub >

github_iconTop Results From Across the Web

INSERT INTO SELECT statement overview and examples
This article covers the INSERT INTO SELECT statement along with its syntax, examples and use cases.
Read more >
Common Issues with the SQL Server Import and Export Wizard
When importing or exporting data using a query, the VARCHAR data type is incorrectly recognised as a '200' data type and the NVARCHAR...
Read more >
INSERT (Transact-SQL) - SQL Server - Microsoft Learn
You can use INSERT INTO <target_table> SELECT <columns> FROM <source_table> to efficiently transfer a large number of rows from one table, such ...
Read more >
Bulk load data conversion error (type mismatch or invalid ...
Try using a format file since your data file only has 4 columns. Otherwise, try OPENROWSET or use a staging table. myTestFormatFiles.Fmt may...
Read more >
MySQL INSERT IGNORE Statement Explained By Examples
When you use the INSERT statement to add multiple rows to a table and if an error occurs during the processing, MySQL terminates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found