> adrian.kla...@aklaver.com wrote:
> 
> The way I see is if it where an actual identifier then this:
> 
> select * from quote_ident('$dog');
> 
> quote_ident
> -------------
> "$dog"
> 
> would be equal to this:
> 
> select * from "$dog";

I think that the clue here is to go into philosophical overdrive. SQL 
statements, and if-then-else programs, are platonic notions. Like in the famous 
example of the notion of Boston itself—as opposed to how it's denoted in 
different contexts. Some would refer to it by saying "Boston". Others would say 
"波士顿".

In our world, the phenomenon is illustrated by this (after authorizing as a 
superuser):

create role "my name" login;
create database db;
grant all on database db to "my name";

\c db "my name"

create schema s;
create table s."silly name"(n int);
select relname
from pg_class c inner join pg_roles r on c.relowner = r.oid
where r.rolname = 'my name';

This is the result (in "\t on" mode)

 silly name

So that's *three* different ways to denote the platonic notion that I had in my 
head, of a certain table in a certain schema in a certain database, before I 
typed anything

What we deal with in our ordinary professional work is SQL texts, program 
source texts, within these, SQL identifier texts, and then the conventional 
display of the results of SQL and program execution. To emphasize the point 
about resulst display, try "\d s.*" in "\t off" mode. You'll see this:

              Table "s.silly name"
 Column |  Type   | Collation | Nullable | Default 
--------+---------+-----------+----------+---------
 n      | integer |           |          | 

But this SQL text:

drop table "s.silly name";

tells me that there's no such table. It's all a matter of convention. In an 
alternative universe, maybe manifest string constants are rendered, with no 
delineation, in red text; and identifiers are rendered, again with no 
delineation, in green text. In another universe, all SQL and program 
composition is done by talking. Manifest string constants are rendered by 
shouting; and identifiers are rendered in a whisper. And why not...



Reply via email to