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?.
ERROR:  permission denied for tablespace pg_default

ERROR:  relation "comments" does not exist
LINE 2:     insert into comments (from_user_id, fk_topic_id, comment...
                        ^
QUERY:  with cte as (
				insert into comments (from_user_id, fk_topic_id, comment_text, parent_comment_id, created)
				values 
					(2, 1, '1bulk test', null, now()) 
				returning comments.comment_id
			)
			insert into comments (from_user_id, fk_topic_id, comment_text, parent_comment_id, created)
				values 
					(3, 1, '1child bulk', (select cte.comment_id from cte), now()),
			     	(3, 1, '1child2 bulk', (select cte.comment_id from cte), now()),
			     	(3, 1, '1child3 bulk', (select cte.comment_id from cte), now()),
			     	(3, 1, '1child4 bulk', (select cte.comment_id from cte), now()),
			     	(3, 1, '1child5 bulk', (select cte.comment_id from cte), now()),
			     	(3, 1, '1child6 bulk', (select cte.comment_id from cte), now())
CONTEXT:  PL/pgSQL function inline_code_block line 7 at SQL statement

ERROR:  relation "comments" does not exist
LINE 4:  FROM comments
              ^