user2148036
user2148036

Reputation: 11

Insert data in a table from a file in PostgreSQL without double quote

I have a file with some data which I need to insert in a table. I am using gpfdist-external table - table to load the file.

I am able to load data in table, but my problem is the fields in input file are enclosed with double quotes like "Emp Name" and the same is going to the database. I don't want these double quotes to go in database. Only the value inside those quotes should go.

I found this somewhere [ENCLOSED BY '"'] but it is not working in greenplum. Kindly tell me where i can change in my external table so that only Value inside the double quotes should go in database not the double quotes.

Thanks and Regards, Sunny

Upvotes: 0

Views: 1163

Answers (1)

mvp
mvp

Reputation: 116317

ENCLOSED BY is MySQL syntax. For PostgreSQL, use COPY operator:

COPY mytable FROM 'filename' CSV HEADER

If you want to specify quoting style, add QUOTE 'quote' - but " is already the default.

One more note: you should upgrade to PostgreSQL 9.2 (or at least 9.1). PostgreSQL 8.4 is very old and not supported very well.

Upvotes: 1

Related Questions