Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What does citext NULL mean in PostgresSQL

What does this mean in PostgreSQL

columnName citext NULL

Im working on some SQL change, there is data in the database, but doesn’t show in the front end. Wonderig if this NULL makes the values go into null state?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The part you have shown means nothing and won’t work as it is.
This will likely be part of a table definition. If you need further details which differenes exist between CITEXT and TEXT or VARCHAR, you should have a look in the documentation: documentation

The "NULL" at the end just means that this column will be nullable. You can remove this if it confuses you. The opposite would be columnName citext NOT NULL. The entire create table command can look like this:

CREATE TABLE example 
(
columnName CITEXT NULL,
columnName2 CITEXT NOT NULL
);

When you want to insert or update rows of this table, only the first column can be null. The second column requires a not null value. As example, this insert will succeed:

INSERT INTO example VALUES (NULL,'1');

But this one will fail:

INSERT INTO example VALUES ('1',NULL);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading