postgresql/src/backend/utils/adt
Tom Lane dd7a8f66ed Redesign tablesample method API, and do extensive code review.
The original implementation of TABLESAMPLE modeled the tablesample method
API on index access methods, which wasn't a good choice because, without
specialized DDL commands, there's no way to build an extension that can
implement a TSM.  (Raw inserts into system catalogs are not an acceptable
thing to do, because we can't undo them during DROP EXTENSION, nor will
pg_upgrade behave sanely.)  Instead adopt an API more like procedural
language handlers or foreign data wrappers, wherein the only SQL-level
support object needed is a single handler function identified by having
a special return type.  This lets us get rid of the supporting catalog
altogether, so that no custom DDL support is needed for the feature.

Adjust the API so that it can support non-constant tablesample arguments
(the original coding assumed we could evaluate the argument expressions at
ExecInitSampleScan time, which is undesirable even if it weren't outright
unsafe), and discourage sampling methods from looking at invisible tuples.
Make sure that the BERNOULLI and SYSTEM methods are genuinely repeatable
within and across queries, as required by the SQL standard, and deal more
honestly with methods that can't support that requirement.

Make a full code-review pass over the tablesample additions, and fix
assorted bugs, omissions, infelicities, and cosmetic issues (such as
failure to put the added code stanzas in a consistent ordering).
Improve EXPLAIN's output of tablesample plans, too.

Back-patch to 9.5 so that we don't have to support the original API
in production.
2015-07-25 14:39:00 -04:00
..
acl.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
array_expanded.c Support "expanded" objects, particularly arrays, for better performance. 2015-05-14 12:08:49 -04:00
array_selfuncs.c Collection of typo fixes. 2015-05-20 16:56:22 +03:00
array_typanalyze.c Collection of typo fixes. 2015-05-20 16:56:22 +03:00
array_userfuncs.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
arrayfuncs.c Fix recently-introduced crash in array_contain_compare(). 2015-05-22 18:36:48 -04:00
arrayutils.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
ascii.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
bool.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
cash.c Collection of typo fixes. 2015-05-20 16:56:22 +03:00
char.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
date.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
datetime.c Replace a bunch more uses of strncpy() with safer coding. 2015-01-24 13:05:42 -05:00
datum.c Support "expanded" objects, particularly arrays, for better performance. 2015-05-14 12:08:49 -04:00
dbsize.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
domains.c Use the typcache to cache constraints for domain types. 2015-03-01 14:06:55 -05:00
encode.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
enum.c Remove enum-related special cases for catalog scans. 2015-04-29 15:48:44 -04:00
expandeddatum.c Support "expanded" objects, particularly arrays, for better performance. 2015-05-14 12:08:49 -04:00
float.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
format_type.c Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
formatting.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
genfile.c Add missing_ok option to the SQL functions for reading files. 2015-06-28 21:35:46 +03:00
geo_ops.c Allow GiST distance function to return merely a lower-bound. 2015-05-15 14:26:51 +03:00
geo_selfuncs.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
inet_cidr_ntop.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
inet_net_pton.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
int8.c Define integer limits independently from the system definitions. 2015-04-02 17:43:35 +02:00
int.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
json.c Support JSON negative array subscripts everywhere 2015-07-17 21:13:47 -04:00
jsonb_gin.c Move strategy numbers to include/access/stratnum.h 2015-05-15 17:03:16 -03:00
jsonb_op.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
jsonb_util.c Revert "Add all structured objects passed to pushJsonbValue piecewise." 2015-05-26 22:54:55 -04:00
jsonb.c Fix treatment of nulls in jsonb_agg and jsonb_object_agg 2015-07-24 09:40:46 -04:00
jsonfuncs.c Remove dead code. 2015-07-19 13:19:38 -04:00
levenshtein.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
like_match.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
like.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
lockfuncs.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
mac.c Allow input format xxxx-xxxx-xxxx for macaddr type 2014-10-21 16:16:39 -04:00
Makefile Support "expanded" objects, particularly arrays, for better performance. 2015-05-14 12:08:49 -04:00
misc.c Fix assorted inconsistencies in our calls of readlink(). 2015-05-28 12:17:22 -04:00
nabstime.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
name.c Add new OID alias type regrole 2015-05-09 13:06:49 -04:00
network_gist.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
network_selfuncs.c Provide real selectivity estimators for inet/cidr operators. 2015-04-01 17:11:21 -04:00
network.c Add geometry/range functions to support BRIN inclusion 2015-05-05 15:22:24 -03:00
numeric.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
numutils.c Define integer limits independently from the system definitions. 2015-04-02 17:43:35 +02:00
oid.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
oracle_compat.c Remove spurious semicolons. 2015-03-31 15:12:27 +03:00
orderedsetaggs.c Extend abbreviated key infrastructure to datum tuplesorts. 2015-05-13 14:36:26 -04:00
pg_locale.c Revoke support for strxfrm() that write past the specified array length. 2015-07-08 20:44:21 -04:00
pg_lsn.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_upgrade_support.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pgstatfuncs.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pseudotypes.c Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
quote.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
rangetypes_gist.c Move strategy numbers to include/access/stratnum.h 2015-05-15 17:03:16 -03:00
rangetypes_selfuncs.c Collection of typo fixes. 2015-05-20 16:56:22 +03:00
rangetypes_spgist.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
rangetypes_typanalyze.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
rangetypes.c Add geometry/range functions to support BRIN inclusion 2015-05-05 15:22:24 -03:00
regexp.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
regproc.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
ri_triggers.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
rowtypes.c Some more FLEXIBLE_ARRAY_MEMBER hacking. 2015-02-20 02:28:03 -05:00
ruleutils.c Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
selfuncs.c Revoke support for strxfrm() that write past the specified array length. 2015-07-08 20:44:21 -04:00
tid.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
timestamp.c Fix comment for GetCurrentIntegerTimestamp(). 2015-06-28 12:43:59 -05:00
trigfuncs.c Use FLEXIBLE_ARRAY_MEMBER for HeapTupleHeaderData.t_bits[]. 2015-02-21 15:13:06 -05:00
tsginidx.c Move strategy numbers to include/access/stratnum.h 2015-05-15 17:03:16 -03:00
tsgistidx.c Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
tsquery_cleanup.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
tsquery_gist.c Move strategy numbers to include/access/stratnum.h 2015-05-15 17:03:16 -03:00
tsquery_op.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
tsquery_rewrite.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
tsquery_util.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
tsquery.c Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
tsrank.c Centralize definition of integer limits. 2015-03-25 22:39:42 +01:00
tsvector_op.c Collection of typo fixes. 2015-05-20 16:56:22 +03:00
tsvector_parser.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
tsvector.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
txid.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
uuid.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
varbit.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
varchar.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
varlena.c In bttext_abbrev_convert, move pfree to the right place. 2015-06-29 23:53:05 -04:00
version.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
windowfuncs.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
xid.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
xml.c Use appendStringInfoString/Char et al where appropriate. 2015-07-02 12:36:03 +03:00