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

UNLOAD query with column name containing \b fails #124

Closed
mayankvadariya opened this issue Nov 12, 2024 · 1 comment
Closed

UNLOAD query with column name containing \b fails #124

mayankvadariya opened this issue Nov 12, 2024 · 1 comment

Comments

@mayankvadariya
Copy link

Driver version

N/A as issue is reproducible in redshift query runner through AWS console. Additionally, issue is reproducible through 2.1.0.30 version as well.

Redshift version

PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.78014

Client Operating System

N/A

JAVA/JVM version

N/A

Table schema

CREATE TABLE test_schema.tcn_abackslash4q3ju8a1ml (
    key character varying(50) ENCODE lzo,
    a\backslash` character varying(50) ENCODE lzo
)
DISTSTYLE AUTO;

Problem description

Below select query with table having a column name containing \b works.

SELECT "a\backslash`" FROM "test_schema"."tcn_abackslash4q3ju8a1ml";

However, corresponding UNLOAD command

UNLOAD ('SELECT "a\backslash`" FROM "test_schema"."tcn_abackslash4q3ju8a1ml"') TO 's3://bucket/location/' IAM_ROLE 'arn:aws:iam::1234567890:role/test_role' FORMAT PARQUET REGION AS 'us-east-1' MAXFILESIZE AS 5 MB;

fails with

[42703] ERROR: column "a�ackslash`" does not exist in tcn_abackslash4q3ju8a1ml
  1. Expected behaviour: UNLOAD select query should have worked as well.
  2. Actual behaviour: UNLOAD select query fails
  3. Error message/stack trace:
  4. Any other details that can be helpful:

JDBC trace logs

Reproduction code

Nothing special about reproduction.

@mayankvadariya
Copy link
Author

UNLOAD query text requires certain illegal characters to be escaped.
ie if we replace "a\backslash`" with "a\\backslash`" in the UNLOAD query then the query will succeed.

UNLOAD ('SELECT "a\\backslash`" FROM "test_schema"."tcn_abackslash4q3ju8a1ml"') TO 's3://bucket/location/' IAM_ROLE 'arn:aws:iam::1234567890:role/test_role' FORMAT PARQUET REGION AS 'us-east-1' MAXFILESIZE AS 5 MB;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant