Re: How to use long list of columns with COPY command

From: M Sarwar <sarwarmd02(at)outlook(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Holger Jakobs <holger(at)jakobs(dot)com>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: How to use long list of columns with COPY command
Date: 2023-06-11 23:45:51
Message-ID: DM4PR19MB59781DC079998909E2A5FCBAD357A@DM4PR19MB5978.namprd19.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi David,
I appreciate your response.
I tried to run COPY from SQL and I got the below error message.

ERROR: COPY from a file is not supported HINT: Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone. SQL state: 0A000

Here is my code:

COPY bronx.TEST_GLOBAL_MCM_RAW (single_date_a, single_start_time_b, dual_part_m, dual_data_n ) FROM 'C:\Mohammed\Work\NGC\Apps\Bronx\Tables\Test_TestData_MCM\Test_TestData_MCM-LoadData\N541652_IN3799A0_CLD_ABMN.csv' DELIMITER ',' CSV Header ;

I am trying to load the data from CSV file to the postgres database.
Thanks,
Sarwar

________________________________
From: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Sent: Sunday, June 11, 2023 7:30 PM
To: M Sarwar <sarwarmd02(at)outlook(dot)com>
Cc: Holger Jakobs <holger(at)jakobs(dot)com>; pgsql-admin(at)lists(dot)postgresql(dot)org <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: How to use long list of columns with COPY command

On Sun, Jun 11, 2023 at 4:04 PM M Sarwar <sarwarmd02(at)outlook(dot)com<mailto:sarwarmd02(at)outlook(dot)com>> wrote:
\COPY

psql \copy and SQL COPY are not the same thing. Haven't tested but SQL COPY shouldn't have this limitation. Use it instead (you never have to use psql \copy, it is only a convenient shortcut).

David J.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2023-06-12 16:43:17 Re: How to use long list of columns with COPY command
Previous Message David G. Johnston 2023-06-11 23:30:23 Re: How to use long list of columns with COPY command