postgresql/src/backend
Tom Lane 7c15cef86d Base information_schema.sql_identifier domain on name, not varchar.
The SQL spec says that sql_identifier is a domain over varchar,
but it also says that that domain is supposed to represent the set
of valid identifiers for the implementation, in particular applying
a length limit matching the implementation's identifier length limit.
We were declaring sql_identifier as just "character varying", thus
duplicating what the spec says about base type, but entirely failing
at the rest of it.

Instead, let's declare sql_identifier as a domain over type "name".
(We can drop the COLLATE "C" added by commit 6b0faf723, since that's
now implicit in "name".)  With the recent improvements to name's
comparison support, there's not a lot of functional difference between
name and varchar.  So although in principle this is a spec deviation,
it's a pretty minor one.  And correctly enforcing PG's name length limit
is a good thing; on balance this seems closer to the intent of the spec
than what we had.

But that's all just language-lawyering.  The *real* reason to do this is
that it makes sql_identifier columns exposed by information_schema views
be just direct representations of the underlying "name" catalog columns,
eliminating a semantic mismatch that was disastrous for performance of
typical queries on the information_schema.  In combination with the
recent change to allow dropping no-op CoerceToDomain nodes, this allows
(for example) queries such as

    select ... from information_schema.tables where table_name = 'foo';

to produce an indexscan rather than a seqscan on pg_class.

Discussion: https://postgr.es/m/CAFj8pRBUCX4LZ2rA2BbEkdD6NN59mgx+BLo1gO08Wod4RLtcTg@mail.gmail.com
2018-12-20 16:21:59 -05:00
..
access Make type "name" collation-aware. 2018-12-19 17:46:25 -05:00
bootstrap Make type "name" collation-aware. 2018-12-19 17:46:25 -05:00
catalog Base information_schema.sql_identifier domain on name, not varchar. 2018-12-20 16:21:59 -05:00
commands Fix lock level used for partition when detaching it 2018-12-20 16:42:13 -03:00
executor Remove extra semicolons. 2018-12-17 14:32:25 +05:30
foreign Introduce new extended routines for FDW and foreign server lookups 2018-12-14 08:59:35 +09:00
jit Fix jit compilation bug on wide tables. 2018-11-27 10:07:03 -08:00
lib Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
libpq Fix typo 2018-12-04 11:04:54 -05:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Make type "name" collation-aware. 2018-12-19 17:46:25 -05:00
optimizer Add text-vs-name cross-type operators, and unify name_ops with text_ops. 2018-12-19 17:46:25 -05:00
parser Make type "name" collation-aware. 2018-12-19 17:46:25 -05:00
partitioning Reduce unnecessary list construction in RelationBuildPartitionDesc. 2018-11-19 12:10:41 -05:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Fix spelling errors and typos in comments 2018-11-02 13:56:52 +01:00
postmaster Modernize our code for looking up descriptive strings for Unix signals. 2018-12-16 19:38:57 -05:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Add timestamp of last received message from standby to pg_stat_replication 2018-12-09 16:35:06 +09:00
rewrite Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
snowball Sync our Snowball stemmer dictionaries with current upstream. 2018-09-24 17:29:38 -04:00
statistics Make pg_statistic and related code account more honestly for collations. 2018-12-14 12:52:49 -05:00
storage Have BufFileSize() ereport() on FileSize() failure. 2018-11-28 14:42:54 -08:00
tcop Silence compiler warning 2018-11-30 10:20:49 -03:00
tsearch Make pg_statistic and related code account more honestly for collations. 2018-12-14 12:52:49 -05:00
utils Avoid producing over-length specific_name outputs in information_schema. 2018-12-20 16:21:59 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Integrate recovery.conf into postgresql.conf 2018-11-25 16:33:40 +01:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00