Database Reference
In-Depth Information
Using the
SELECT
statement in the
foo_new
table with the
LOWER
function of
fname
as
foo
:
warehouse_db=# SELECT * FROM foo_new WHERE LOWER(fname) =
LOWER('foo');
id | fname | lname
----+-------+-------
1 | foo | bar
(1 row)
Using the
SELECT
statement in the
foo_new
table with the
LOWER
function of
fname
as
FOO
:
warehouse_db=# SELECT * FROM foo_new WHERE LOWER(fname) =
LOWER('FOO');
id | fname | lname
----+-------+-------
1 | foo | bar
(1 row)
In case of a
citext
data type, we don't need to call the
LOWER
or
UPPER
function
while doing a case-insensitive search.
Using the
SELECT
statement in the
foo_new
table with
lname
as
bar
:
warehouse_db=# SELECT * FROM foo_new WHERE lname = 'bar';
id | fname | lname
----+-------+-------
1 | foo | bar
(1 row)
Using the
SELECT
statement in the
foo_new
table with
lname
as
BAR
:
warehouse_db=# SELECT * FROM foo_new WHERE lname = 'BAR';
id | fname | lname
----+-------+-------
1 | foo | bar
(1 row)
The
citext
data type is not as eficient as text.