Database Reference
In-Depth Information
UPDATE list_demo SET list_col = list_col - [1] WHERE id = 1;
SELECT * FROM list_demo;
id | list_col
----+-----------
1 | [0, 4, 5]
(1 rows)
Sets
Sets are comma-separated values in curly brackets. Sets cannot have duplicates:
{item1, item2, …}
Apart from the fact that a set is not ordered and contains unique values, it behaves the
same way as a list, except that you cannot use an index to delete or update items. In real-
ity, you do not need an index when items are unique, because their values are going to
work as an identifier to them.
Here are some example operations:
# Create a simple table and insert a set with duplicates
CREATE TABLE set_demo (id int PRIMARY KEY, set_col
set<text>);
INSERT INTO set_demo (id, set_col ) VALUES ( 1, {'head',
'tail', 'head'});
SELECT * FROM set_demo;
id | set_col
----+------------------
Search WWH ::




Custom Search