add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE test (
id SERIAL NOT NULL,
name VARCHAR NOT NULL,
PRIMARY KEY (id),
UNIQUE (name)
);
INSERT INTO test (name) VALUES ('👍🏻 One');
INSERT INTO test (name) VALUES ('👍 Two');

SELECT * FROM test;


CREATE TABLE
INSERT 0 1
INSERT 0 1
id name
1 👍🏻 One
2 👍 Two
SELECT 2
-- your query
SELECT * FROM test WHERE name LIKE '👍%';
id name
1 👍🏻 One
2 👍 Two
SELECT 2
-- query with light skin
SELECT * FROM test WHERE name LIKE '👍🏻%';
id name
1 👍🏻 One
SELECT 1
-- your query with space after emoji
SELECT * FROM test WHERE name LIKE '👍 %';
id name
2 👍 Two
SELECT 1
SELECT * FROM test
WHERE name LIKE '👍%'
AND name NOT LIKE '👍🏻%'
AND name NOT LIKE '👍🏼%'
And name NOT LIKE '👍🏽%'
And name NOT LIKE '👍🏾%'
And name NOT LIKE '👍🏿%'
id name
2 👍 Two
SELECT 1
SELECT * FROM test
WHERE name ~ '^👍[^🏻🏼🏽🏾🏿]*$'
id name
2 👍 Two
SELECT 1