Re: load fom csv
Muhammad Usman Khan <usman.k@bitnine.net>
From: Muhammad Usman Khan <usman.k@bitnine.net>
To: Andy Hartman <hartman60home@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Date: 2024-09-17T05:55:24Z
Lists: pgsql-general
Hi, Try the following options: - Check if psql is working independently: psql -h $pgServer -d $pgDatabase -U $pgUser -c "SELECT 1;" - Check for permission issues on the CSV file - Run the command manually without variables psql -h your_host -d your_db -U your_user -c "\COPY your_table FROM 'C:/path/to/your/file.csv' DELIMITER ',' CSV HEADER;" - set a timeout using the PGCONNECT_TIMEOUT environment variable: $env:PGCONNECT_TIMEOUT=30 On Mon, 16 Sept 2024 at 20:35, Andy Hartman <hartman60home@gmail.com> wrote: > I'm trying to run this piece of code from Powershell and it just sits > there and never comes back. There are only 131 records in the csv. > > $connectionString = > "Host=$pgServer;Database=$pgDatabase;Username=$pgUser;Password=$pgPassword" > $copyCommand = "\COPY $pgTable FROM '$csvPath' DELIMITER ',' CSV HEADER;" > > psql -h $pgServer -d $pgDatabase -U $pgUser -c $copyCommand > > > how can I debug this? > > Table layout > > [image: image.png] >