Premise
I recently ran into an expression error selectin my code. It was pretty trivial to fix it when I realized what was going on, but I was interested in finding a way to make sure that such an error would not happen again.
Here is an example of an abusive request:
select
the,
quick,
brown
fox,
jumped,
over,
the,
lazy,
dog
from table_name;
I mean:
select
the,
quick,
brown,
fox,
jumped,
over,
the,
lazy,
dog
from table_name;
For those who do not see this, the comma is missing after brownthe first. This causes the column to be an alias since the keyword ashas no . So what do you get as a result:
the,
quick,
fox,
jumped,
over,
the,
lazy,
dog
... brown fox. , (, ), , , :
select
foo,
bar,
baz,
another_table.quux,
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
a15,
a16,
b1,
b2,
b3,
b7,
b8,
b9,
b10,
b11,
b12,
b13,
b14,
b18,
b19,
b20,
b21,
c1,
c2,
c3,
c4,
c5,
c6,
c7,
c8
from table_name
join another_table on table_name.foo_id = another_table.id
where
blah = 'blargh'
;
. b11 (), b11 b12, , ( ). select * from table_name, , .
, .
as ? , ? (, C- 1 == foo foo == 1, , , 1 = foo foo = 1.)
vim, hlsearch, , . , , , - .
!