An integer column can be null, but '' is an empty string not null. The right syntax for a null integer (or any other sql type) is null.

Answer from Sam Hartman on Stack Overflow
🌐
PostgreSQL
postgresql.org › message-id › [email protected]
PostgreSQL: Re: Inserting NULL into Integer column
February 18, 2004 - Phew, now that that's out of the way, here's the standard ways of doing it. Use DEFAULT: If no default is it will insert a NULL, otherwise the default will be inserted: insert into table (integervar) values (DEFAULT);
🌐
Quora
quora.com › What-is-the-definition-of-a-null-value-Can-a-null-value-be-assigned-to-an-integer-column-in-PostgreSQL
What is the definition of a null value? Can a null value be assigned to an integer column in PostgreSQL? - Quora
The answer to the second question is yes, a SQL NULL can be assigned to an integer (or any other type) column in PostgreSQL - assuming the column doesn’t have a NOT NULL constraint - in one of several ...
🌐
Percona
percona.com › home › why postgresql null values break your queries (and how to fix them)
Why PostgreSQL NULL Values Break Your Queries (And How to Fix Them)
July 7, 2025 - You still use the same equality operators for comparison, but when you print it, you’ll see the literal word “null” (always lowercase in Java). ... PostgreSQL’s NULL means “no value.” It is not 0, an empty string, or a single space, ...
🌐
GitHub
github.com › brianc › node-postgres › issues › 1649
Inserting null values to integer columns using a prepared statement · Issue #1649 · brianc/node-postgres
May 15, 2018 - UnhandledPromiseRejectionWarning: error: invalid input syntax for integer: "" This is because I want to enter a null value into a column that is a number. But it seems impossible to do with a prepared statement.
Published   May 15, 2018
🌐
Neon
neon.com › postgresql › postgresql-tutorial › postgresql-is-null
PostgreSQL IS NULL
To check if a value is NULL or not, you cannot use the equal to (=) or not equal to (<>) operators. Instead, you use the IS NULL operator.
🌐
PostgreSQL
postgresql.org › docs › current › datatype-numeric.html
PostgreSQL: Documentation: 18: 8.1. Numeric Types
3 weeks ago - Thus, we have created an integer column and arranged for its default values to be assigned from a sequence generator. A NOT NULL constraint is applied to ensure that a null value cannot be inserted.
🌐
Restack
restack.io › p › understanding-tinyint-vs-int-in-sql-answer-insert-null-integer
Postgres Insert Null Into Integer | Restackio
Learn how to handle null values in integer columns with Postgres, focusing on the nuances of inserting nulls effectively. ... When working with integer columns in PostgreSQL, inserting NULL values is a straightforward process that can be crucial for maintaining data integrity.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › postgresql › postgresql_null_values.htm
PostgreSQL - NULL Values
The PostgreSQL NULL is the term used to represent a missing value. A NULL value in a table is a value in a field that appears to be blank.
🌐
PostgreSQL
postgresql.org › message-id › [email protected]
PostgreSQL: Re: testing for null value in integer field?
December 19, 2003 - Wei Weng wrote: > Geoffrey wrote: > >> How does one check for an unset value in an integer field? >> >> I've tried such things as: >> >> select ..... where intnumber = '' >> select ...... where intnumber = ? >> select ..... where intnumber = NULL >> >> Thanks.
🌐
GeeksforGeeks
geeksforgeeks.org › postgresql › postgresql-is-null-operator
PostgreSQL - IS NULL operator - GeeksforGeeks
July 12, 2025 - Since NULL cannot be compared directly with any integer or string (as such comparisons result in NULL, meaning an unknown result), the IS NULL operator is crucial for identifying NULL values.
🌐
Blogger
florentpousserot.blogspot.com › 2012 › 11 › postgresql-cast-null-or-empty-string-to.html
Florent Pousserot: Postgresql : Cast NULL or empty string to int
Actually, you can cast NULL to int, you just can't cast an empty string to int. Assuming you want NULL in the new column if data1 co...
🌐
Neon
neon.com › postgresql › postgresql-tutorial › postgresql-nullif
PostgreSQL NULLIF function
The NULLIF() function is one of the most common conditional expressions provided by PostgreSQL.
🌐
Quora
quora.com › How-do-you-insert-a-null-value-in-PostgreSQL
How to insert a null value in PostgreSQL - Quora
Answer: Just not refering to the columns you expect having NULL value in the INSERT statement. On condition they don’t have a NOT NULL constraint. Let’s say you have the table dummy(id int, name varchar(20), location varchar(32)) then you can write: INSERT INTO dummy (id) VALUES (1), (2), (3) th...