postgresql/src/include
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 Create a separate oid range for oids assigned by genbki.pl. 2018-12-13 14:50:57 -08:00
bootstrap Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
catalog Base information_schema.sql_identifier domain on name, not varchar. 2018-12-20 16:21:59 -05:00
commands Make pg_statistic and related code account more honestly for collations. 2018-12-14 12:52:49 -05:00
common Add application_name to connection authorized msg 2018-09-28 19:04:50 -04:00
datatype Update copyright for 2018 2018-01-02 23:30:12 -05:00
executor Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
fe_utils Add CSV table output mode in psql. 2018-11-26 15:18:55 -05:00
foreign Introduce new extended routines for FDW and foreign server lookups 2018-12-14 08:59:35 +09:00
jit Make TupleTableSlots extensible, finish split of existing slot type. 2018-11-16 16:35:15 -08:00
lib Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
libpq Add settings to control SSL/TLS protocol version 2018-11-20 22:12:10 +01:00
mb Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
nodes Make bitmapset.c use 64-bit bitmap words on 64-bit machines. 2018-12-20 12:19:07 -05:00
optimizer Drop no-op CoerceToDomain nodes from expressions at planning time. 2018-12-13 13:24:43 -05:00
parser Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
partitioning Reduce unnecessary list construction in RelationBuildPartitionDesc. 2018-11-19 12:10:41 -05:00
port Avoid defining SIGTTIN/SIGTTOU on Windows. 2018-11-17 16:31:16 -05:00
portability instr_time.h: add INSTR_TIME_SET_CURRENT_LAZY 2018-11-21 15:04:25 -03:00
postmaster Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
regex Update copyright for 2018 2018-01-02 23:30:12 -05:00
replication Add timestamp of last received message from standby to pg_stat_replication 2018-12-09 16:35:06 +09:00
rewrite Revert MERGE patch 2018-04-12 11:22:56 +01: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 Add WL_EXIT_ON_PM_DEATH pseudo-event. 2018-11-23 20:46:34 +13:00
tcop Fix event triggers for partitioned tables 2018-10-06 19:17:46 -03:00
tsearch Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
utils Make type "name" collation-aware. 2018-12-19 17:46:25 -05:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Improve unconstify() documentation 2018-10-25 01:02:46 +01:00
fmgr.h Add expression compilation support to LLVM JIT provider. 2018-03-22 14:45:59 -07:00
funcapi.h Clean up in the wake of TupleDescGetSlot() removal / 10763358c3. 2018-09-27 11:38:11 -07:00
getaddrinfo.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
getopt_long.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
Makefile Refactor dlopen() support 2018-09-06 11:33:04 +02:00
miscadmin.h Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
pg_config.h.in Drop support for getting signal descriptions from sys_siglist[]. 2018-12-17 13:50:16 -05:00
pg_config.h.win32 Modernize our code for looking up descriptive strings for Unix signals. 2018-12-16 19:38:57 -05:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Improve error reporting for unsupported effective_io_concurrency setting. 2018-09-28 16:12:13 -04:00
pg_getopt.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_trace.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgstat.h Add pg_promote function 2018-10-25 09:46:00 +09:00
pgtar.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgtime.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
port.h Modernize our code for looking up descriptive strings for Unix signals. 2018-12-16 19:38:57 -05:00
postgres.h Detoast plpgsql variables if they might live across a transaction boundary. 2018-05-16 14:56:52 -04:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rusagestub.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
windowapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00