From: "David E. Wheeler" on 15 Nov 2009 14:25 On Nov 15, 2009, at 11:21 AM, Greg Stark wrote: > No, that's not the same. > > The point is that $ is a perfectly valid SQL identifier character and > $foo is a perfectly valid identifier. You can always quote any > identifier (yes, after case smashing) so you would expect if $foo is a > valid identifier then "$foo" would refer to the same identifier. > You're introducing a meaning for $foo but saying there's no valid way > to quote the identifier to get the same thing. And worse, if you do > quote it you get something else entirely different. $foo should be killed off as a valid identifier, IMNSHO. But failing that, some other sigil would be most welcome. Best, David -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Greg Stark on 15 Nov 2009 14:35 On Sun, Nov 15, 2009 at 7:25 PM, David E. Wheeler <david(a)kineticode.com> wrote: > On Nov 15, 2009, at 11:21 AM, Greg Stark wrote: > > > $foo should be killed off as a valid identifier, IMNSHO. > > But failing that, some other sigil would be most welcome. I don't think SQL is the height of language design either. But trying to turn it into another language piece by piece is not gong to make it any nicer. A sigil here doesn't accomplish anything. The identifiers in question are *just* like other identifiers. They can be used in expressions just like other columns, they have various types, they have the same syntax as other columns, the sigil doesn't mean anything. I think what may be making this tempting is that they look vaguely like ODBC/JDBC/DBI placeholders like :foo. However they're very very different. In those cases the sigil is marking the sigil outside the SQL syntax. They will be replaced textually without parsing the SQL at all. It's actually very confusing having $foo indicate something within SQL since it makes it look like it's some external thing from another layer like the placeholders. -- greg -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Andrew Dunstan on 15 Nov 2009 14:39 David E. Wheeler wrote: > > $foo should be killed off as a valid identifier, IMNSHO. > > > It's only legal when quoted. Unquoted indetifiers can't begin with $. see scan.l: ident_start [A-Za-z\200-\377_] ident_cont [A-Za-z\200-\377_0-9\$] identifier {ident_start}{ident_cont}* cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: "David E. Wheeler" on 15 Nov 2009 14:51 On Nov 15, 2009, at 11:35 AM, Greg Stark wrote: > I don't think SQL is the height of language design either. But trying > to turn it into another language piece by piece is not gong to make it > any nicer. I don't know of anyone suggesting such a thing. > A sigil here doesn't accomplish anything. The identifiers in question > are *just* like other identifiers. They can be used in expressions > just like other columns, they have various types, they have the same > syntax as other columns, the sigil doesn't mean anything. So what is the $ for in $1, $2, etc.? > I think what may be making this tempting is that they look vaguely > like ODBC/JDBC/DBI placeholders like :foo. However they're very very > different. In those cases the sigil is marking the sigil outside the > SQL syntax. They will be replaced textually without parsing the SQL at > all. It's actually very confusing having $foo indicate something > within SQL since it makes it look like it's some external thing from > another layer like the placeholders. It's not in SQL; it's in SQL functions (and DO blocks). AFAIK, the major database vendors all use some sort of character to identify variables within functions. It's proven, avoids conflicts (you can't have an identifier named $foo, as Andrew just pointed out), and just generally makes maintenance easier. Best, David -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Andrew Chernow on 15 Nov 2009 14:56
> The point is that $ is a perfectly valid SQL identifier character and > $foo is a perfectly valid identifier. You can always quote any > identifier (yes, after case smashing) so you would expect if $foo is a > valid identifier then "$foo" would refer to the same identifier. > This case already exists via $1 and "$1". Making '$' a marker for parameters wouldn't introduce it. -- Andrew Chernow eSilo, LLC every bit counts http://www.esilo.com/ -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers |