postgresql/src/backend/utils/adt
Tomas Vondra 33e52ad9a3 Fix ndistinct estimates with system attributes
When estimating the number of groups using extended statistics, the code
was discarding information about system attributes. This led to strange
situation that

    SELECT 1 FROM t GROUP BY ctid;

could have produced higher estimate (equal to pg_class.reltuples) than

    SELECT 1 FROM t GROUP BY a, b, ctid;

with extended statistics on (a,b). Fixed by retaining information about
the system attribute.

Backpatch all the way to 10, where extended statistics were introduced.

Author: Tomas Vondra
Backpatch-through: 10
2021-03-26 22:34:58 +01:00
..
.gitignore Revert "Add gitignore entries for jsonpath_gram.h" 2019-03-23 00:19:34 +01:00
acl.c Add "pg_database_owner" default role. 2021-03-26 10:42:17 -07:00
amutils.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
array_expanded.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
array_selfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
array_typanalyze.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
array_userfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
arrayfuncs.c Add trim_array() function. 2021-03-03 16:39:57 -05:00
arraysubs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
arrayutils.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
ascii.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
bool.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
cash.c Expose internal function for converting int64 to numeric 2020-09-09 20:16:28 +02:00
char.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
cryptohashfuncs.c Add result size as argument of pg_cryptohash_final() for overflow checks 2021-02-15 10:18:34 +09:00
date.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
datetime.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
datum.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
dbsize.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
domains.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
encode.c Rework refactoring of hex and encoding routines 2021-01-14 11:13:24 +09:00
enum.c Rename "enum blacklist" to "uncommitted enums". 2021-01-05 12:38:48 +13:00
expandeddatum.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
expandedrecord.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
float.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
format_type.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
formatting.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
genfile.c Fix function name in error hint 2021-03-18 11:22:20 +01:00
geo_ops.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
geo_selfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
geo_spgist.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
inet_cidr_ntop.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
inet_net_pton.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
int8.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
int.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
json.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
jsonb_gin.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
jsonb_op.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
jsonb_util.c Implementation of subscripting for jsonb 2021-01-31 23:50:40 +03:00
jsonb.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
jsonbsubs.c Get rid of unnecessary memory allocation in jsonb_subscript_assign() 2021-02-01 14:06:02 +03:00
jsonfuncs.c Improve reporting for syntax errors in multi-line JSON data. 2021-03-01 16:44:17 -05:00
jsonpath_exec.c Fix some typos, grammar and style in docs and comments 2021-02-24 16:13:17 +09:00
jsonpath_gram.y Update copyright for 2021 2021-01-02 13:06:25 -05:00
jsonpath_scan.l Update copyright for 2021 2021-01-02 13:06:25 -05:00
jsonpath.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
levenshtein.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
like_match.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
like_support.c Avoid divide-by-zero in regex_selectivity() with long fixed prefix. 2021-02-12 16:26:47 -05:00
like.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
lockfuncs.c Display the time when the process started waiting for the lock, in pg_locks, take 2 2021-02-15 15:13:37 +09:00
mac8.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
mac.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
Makefile Implementation of subscripting for jsonb 2021-01-31 23:50:40 +03:00
mcxtfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
misc.c Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
multirangetypes_selfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
multirangetypes.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
name.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
network_gist.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
network_selfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
network_spgist.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
network.c Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
numeric.c Add an explicit cast to double when using fabs(). 2021-01-05 11:52:42 +00:00
numutils.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
oid.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
oracle_compat.c Add bytea equivalents of ltrim() and rtrim(). 2021-01-18 15:11:32 -05:00
orderedsetaggs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
partitionfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_locale.c Revert "pg_collation_actual_version() -> pg_collation_current_version()." 2021-02-26 15:29:27 +13:00
pg_lsn.c Simplify printing of LSNs 2021-02-23 10:27:02 +01:00
pg_upgrade_support.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pgstatfuncs.c Track total amounts of times spent writing and syncing WAL data to disk. 2021-03-09 16:52:06 +09:00
pseudotypes.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
quote.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rangetypes_gist.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rangetypes_selfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rangetypes_spgist.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rangetypes_typanalyze.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rangetypes.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
regexp.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
regproc.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
ri_triggers.c ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY 2021-03-25 18:00:28 -03:00
rowtypes.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
ruleutils.c Implement GROUP BY DISTINCT 2021-03-18 18:22:18 +01:00
selfuncs.c Fix ndistinct estimates with system attributes 2021-03-26 22:34:58 +01:00
tid.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
timestamp.c Fix stray double semicolons 2021-03-24 20:42:51 +01:00
trigfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsginidx.c Convert tsginidx.c's GIN indexing logic to fully ternary operation. 2021-02-16 12:07:14 -05:00
tsgistidx.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsquery_cleanup.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsquery_gist.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsquery_op.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsquery_rewrite.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsquery_util.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsquery.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsrank.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsvector_op.c Convert tsginidx.c's GIN indexing logic to fully ternary operation. 2021-02-16 12:07:14 -05:00
tsvector_parser.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tsvector.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
uuid.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
varbit.c Add bit_count SQL function 2021-03-23 10:13:58 +01:00
varchar.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
varlena.c Add bit_count SQL function 2021-03-23 10:13:58 +01:00
version.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
windowfuncs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
xid8funcs.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
xid.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
xml.c Simplify some comments in xml.c 2021-01-04 19:47:58 +09:00