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

Bug when creating table in attached postgres 'SQL Error: Invalid Error: Failed to prepare COPY "' #250

Closed
YuriyGavrilov opened this issue Aug 25, 2024 · 2 comments · Fixed by #253

Comments

@YuriyGavrilov
Copy link

Hi

There is a strange error when I making create table in attached pg.

make

INSTALL postgres;
LOAD postgres;
INSTALL httpfs;
LOAD httpfs;
ATTACH 'dbname=postgres user=postgres host=127.0.0.1 password=mysecretpassword port=5432' AS db (TYPE POSTGRES);

create table db.public.big_csv_s3 as select * from 's3://duckdb/bigcsv/2018_Yellow_Taxi_Trip_Data.csv.gz';
select * from db.public.big_csv_s3

receiving


SQL Error: Invalid Error: Failed to prepare COPY "
	COPY (SELECT "VendorID", "tpep_pickup_datetime", "tpep_dropoff_datetime", "passenger_count", "trip_distance", "RatecodeID", "store_and_fwd_flag", "PULocationID", "DOLocationID", "payment_type", "fare_amount", "extra", "mta_tax", "tip_amount", "tolls_amount", "improvement_surcharge", "total_amount" FROM "public"."big_csv_s3" WHERE ctid BETWEEN '(0,0)'::tid AND '(1000,0)'::tid) TO STDOUT (FORMAT binary);
	": ERROR:  column "VendorID" does not exist
LINE 2:  COPY (SELECT "VendorID", "tpep_pickup_datetime", "tpep_drop...
                      ^
HINT:  Perhaps you meant to reference the column "big_csv_s3.vendorid".

but everything is ok in pg
Снимок экрана 2024-08-26 в 00 32 57

if I make another attach pg like pg2 then I cat select this table.

so some errors in some cache data maybe.

Снимок экрана 2024-08-26 в 00 35 26
@Mytherin
Copy link
Contributor

Mytherin commented Sep 3, 2024

Thanks for the report! I've pushed a fix in #253

Mytherin added a commit that referenced this issue Sep 3, 2024
Fix #250 - always quote column names in CREATE TABLE to avoid Postgres' lowercasing them
@YuriyGavrilov
Copy link
Author

Wow, so fast 🚀

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