on conflict do update (& `language` named column)
I found two issues. First, #150 which seems to occur again.
The second is each time I reference a table named language, the formatter inserts a newline.
Here is my query:
insert into videos(sha, idx, title, language, codec, mime_codec, width, height, is_default, bitrate)
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
on conflict (sha, idx) do update set
sha = excluded.sha,
idx = excluded.idx,
title = excluded.title,
language = excluded.language,
codec = excluded.codec,
mime_codec = excluded.mime_codec,
width = excluded.width,
height = excluded.height,
is_default = excluded.is_default,
bitrate = excluded.bitrate;
and it gets formatted like:
insert into videos (sha, idx, title,
language, codec, mime_codec, width, height, is_default, bitrate)
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
on conflict (sha, idx)
do update set
sha = excluded.sha, idx = excluded.idx, title = excluded.title,
language =
excluded.language, codec = excluded.codec, mime_codec = excluded.mime_codec, width = excluded.width, height = excluded.height, is_default = excluded.is_default, bitrate = excluded.bitrate;
notice how there's a newline before every language.
if I remove each reference to this table, i get this:
insert into videos (sha, idx, title, codec, mime_codec, width, height, is_default, bitrate)
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
on conflict (sha, idx)
do update set
sha = excluded.sha, idx = excluded.idx, title = excluded.title, codec = excluded.codec, mime_codec = excluded.mime_codec, width = excluded.width, height = excluded.height, is_default = excluded.is_default, bitrate = excluded.bitrate;
and I'd expect every statement in do update set to be on a single line (like in my initial example or what was talked in #150).
Thanks for the report #150 is solves but language is recognize as a plpgsql keyword which should not happen. I'll have a look
are you sure #150 is fixed? i tested both locally and on the website and both gave this sql:
insert into videos (sha, idx, title, codec, mime_codec, width, height, is_default, bitrate)
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
on conflict (sha, idx)
do update set
sha = excluded.sha, idx = excluded.idx, title = excluded.title, codec = excluded.codec, mime_codec = excluded.mime_codec, width = excluded.width, height = excluded.height, is_default = excluded.is_default, bitrate = excluded.bitrate;
i'd expect it to format like this:
insert into videos(sha, idx, title, codec, mime_codec, width, height, is_default, bitrate)
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
on conflict (sha, idx)
do update set
sha = excluded.sha,
idx = excluded.idx,
title = excluded.title,
codec = excluded.codec,
mime_codec = excluded.mime_codec,
width = excluded.width,
height = excluded.height,
is_default = excluded.is_default,
bitrate = excluded.bitrate;
You are right, I will fix it again in the same commit.
Fixed by commit 5c7463d.
Note that this patch break the form:
...
DO UPDATE SET
(a, b, c) = (excluded.a, excluded.b, excluded.c);
I will try to fix this later.
Commit 025004d fix the last issue.