SELECT * FROM comment ORDER BY array_length(path, 1) ASC, rating DESC
# Query the database and obtain data as Python objects
>>> cur.execute("SELECT * FROM test;")
>>> cur.fetchone()
(1, 100, "abc'def")
# Make the changes to the database persistent
>>> conn.commit()
burik=# create table test (id serial not null primary key, value integer);
CREATE TABLE
burik=# alter sequence test_id_seq maxvalue 2;
ALTER SEQUENCE
burik=# insert into test (value) VALUES(1);
INSERT 0 1
burik=# insert into test (value) VALUES(2);
INSERT 0 1
burik=# insert into test (value) VALUES(3);
ERROR: nextval: reached maximum value of sequence "test_id_seq" (2)