ERROR: invalid input syntax for integer: “”
""
isn’t a valid integer. PostgreSQL accepts unquoted blank fields as null by default in CSV, but ""
would be like writing:
SELECT ''::integer;
and fail for the same reason.
If you want to deal with CSV that has things like quoted empty strings for null integers, you’ll need to feed it to PostgreSQL via a pre-processor that can neaten it up a bit. PostgreSQL’s CSV input doesn’t understand all the weird and wonderful possible abuses of CSV.
Options include:
- Loading it in a spreadsheet and exporting sane CSV;
- Using the Python
csv
module, PerlText::CSV
, etc to pre-process it; - Using Perl/Python/whatever to load the CSV and insert it directly into the DB
- Using an ETL tool like CloverETL, Talend Studio, or Pentaho Kettle
Related Posts:
- PostgreSQL: Show tables in PostgreSQL
- Psql could not connect to server: No such file or directory, 5432 error?
- Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails
- What is the format for the PostgreSQL connection string / URL?
- “use database_name” command in PostgreSQL
- PSQLException: current transaction is aborted, commands ignored until end of transaction block
- psql: FATAL: Ident authentication failed for user “postgres”
- fe_sendauth: no password supplied
- How can I import an Excel file into SQL Server?
- How can I drop all the tables in a PostgreSQL database?
- How to restart PostgreSQL in Ubuntu 18.04
- FATAL: password authentication failed for user “postgres” (postgresql 11 with pgAdmin 4)
- Postgresql: Scripting psql execution with password
- postgresql duplicate key violates unique constraint
- “psql: could not connect to server: Connection refused” Error when connecting to remote database
- How to change PostgreSQL user password?
- No function matches the given name and argument types
- PostgreSQL error: Fatal: role “username” does not exist
- “extra data after last expected column” while trying to import a csv file into postgresql
- How to change PostgreSQL user password?
- How to exit from PostgreSQL command line utility: psql
- psql: FATAL: database “
” does not exist - eroku “psql: FATAL: remaining connection slots are reserved for non-replication superuser connections”
- Permission denied for relation
- postgres does not know where to find server configuration
- input file appears to be a text format dump. Please use psql
- Postgres: INSERT if does not exist already
- How to import CSV into Custom Post Type custom fields?
- CSV syntax for WP All Import upload without ACF
- Importing CSV into database table not working?
- How to handle a CSV with 65,000+ rows and make it searchable?
- Huge category CSV import does not work
- Feed format for woocommerce [closed]
- What’s the fastest way to import products with variations in WooCommerce (CSV, XML, …) [closed]
- Create a form with custom autocomplete address field and CSV import values
- Undo WooCommerce CSV import
- Import user data using CSV
- Import users once a day without a plugin
- CSV to WordPress posts: do I have to populate each possible field?
- best way to upload a large file to wordpress using wp all import
- Upload advanced custom field text link array with csv
- Pull specific data from CSV
- Creating connections programmatically with common fields on CPT’s
- How to cdv from a custom CMS to WP
- Create CSV for import from File directories?
- What’s the default superuser username/password for postgres after a new install?
- How to see active connections and “current activity” in PostgreSQL 8.4
- pg_dump and pg_restore: input file does not appear to be a valid archive
- Creating posts with php-script + csv
- How do I copy a file in Python?
- How do I copy a file in Python?
- TypeError: list indices must be integers or slices, not str
- IndexError: too many indices for array
- IndexError: too many indices for array
- Import Error: No module named numpy
- Writing a pandas DataFrame to CSV file
- Writing a pandas DataFrame to CSV file
- Python random function
- List changes unexpectedly after assignment. Why is this and how can I prevent it?
- Exception in thread “main” java.lang.Error: Unresolved compilation problems
- Exception in thread “main” java.lang.Error: Unresolved compilation problems
- beyond top level package error in relative import
- What is this JavaScript “require”?
- beyond top level package error in relative import
- IndexError: too many indices for array
- How do I copy a folder from remote to local using scp?
- What is the difference between a deep copy and a shallow copy?
- ValueError : I/O operation on closed file
- What is this JavaScript “require”?
- `from … import` vs `import .` [duplicate]
- Copying a local file from Windows to a remote server using scp
- beyond top level package error in relative import
- ImportError: No module named ‘pygame’
- PostgreSQL “DESCRIBE TABLE”
- How do I copy a file in Python?
- ImportError: No module named ‘pygame’
- Pandas: ValueError: cannot convert float NaN to integer
- csv.Error: iterator should return strings, not bytes
- Relative imports for the billionth time
- Python – from . import
- Make copy of an array
- Yahoo! Finance CSV file will not return Dow Jones (^DJI)
- Python – Reading and writing csv files with utf-8 encoding
- Invalid column count in CSV input on line 1 Error
- How to copy a file from one directory to another using PHP?
- How do I import an SQL file using the command line in MySQL?
- Call a function from another file?
- How to UPSERT (MERGE, INSERT … ON DUPLICATE UPDATE) in PostgreSQL?
- Invalid column count in CSV input on line 1 Error
- How to restart Postgresql
- How do I copy an object in Java?
- Python Error io.UnsupportedOperation: not readable
- How do I import an SQL file using the command line in MySQL?
- load csv into 2D matrix with numpy for plotting
- Cleanest way to copy a constant size array in c++11
- The difference between “require(x)” and “import x”
- Dump a NumPy array into a csv file
- (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape
- Import / Export database with SQL Server Server Management Studio
- How to parse a CSV file using PHP