From 20540710e83f2873707c284a0c0693f0b57156c4 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 4 Nov 2016 18:29:53 -0400 Subject: Delete contrib/xml2's legacy implementation of xml_is_well_formed(). This function is unreferenced in modern usage; it was superseded in 9.1 by a core function of the same name. It has been left in place in the C code only so that pre-9.1 SQL definitions of the contrib/xml2 functions would continue to work. Six years seems like enough time for people to have updated to the extension-style version of the xml2 module, so let's drop this. The key reason for not keeping it any longer is that we want to stick an explicit PGDLLEXPORT into PG_FUNCTION_INFO_V1(), and the similarity of name to the core function creates a conflict that compilers will complain about. Extracted from a larger patch for that purpose. I'm committing this change separately to give it more visibility in the commit logs. While at it, remove the documentation entry that claimed that xml_is_well_formed() is a function provided by contrib/xml2, and instead mention the even more ancient alias xml_valid(). Laurenz Albe, doc change by me Patch: --- contrib/xml2/xpath.c | 45 --------------------------------------------- 1 file changed, 45 deletions(-) (limited to 'contrib/xml2/xpath.c') diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index ac28996867..28445be369 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -81,51 +81,6 @@ pgxml_parser_init(PgXmlStrictness strictness) } -/* - * Returns true if document is well-formed - * - * Note: this has been superseded by a core function. We still have to - * have it in the contrib module so that existing SQL-level references - * to the function won't fail; but in normal usage with up-to-date SQL - * definitions for the contrib module, this won't be called. - */ - -PG_FUNCTION_INFO_V1(xml_is_well_formed); - -Datum -xml_is_well_formed(PG_FUNCTION_ARGS) -{ - text *t = PG_GETARG_TEXT_P(0); /* document buffer */ - bool result = false; - int32 docsize = VARSIZE(t) - VARHDRSZ; - xmlDocPtr doctree; - PgXmlErrorContext *xmlerrcxt; - - xmlerrcxt = pgxml_parser_init(PG_XML_STRICTNESS_LEGACY); - - PG_TRY(); - { - doctree = xmlParseMemory((char *) VARDATA(t), docsize); - - result = (doctree != NULL); - - if (doctree != NULL) - xmlFreeDoc(doctree); - } - PG_CATCH(); - { - pg_xml_done(xmlerrcxt, true); - - PG_RE_THROW(); - } - PG_END_TRY(); - - pg_xml_done(xmlerrcxt, false); - - PG_RETURN_BOOL(result); -} - - /* Encodes special characters (<, >, &, " and \r) as XML entities */ PG_FUNCTION_INFO_V1(xml_encode_special_chars); -- cgit v1.2.3 From c59f94e81e56fe24428952f116f3c9555f42cc4f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 7 Nov 2016 10:27:52 -0500 Subject: Revert "Delete contrib/xml2's legacy implementation of xml_is_well_formed()." This partly reverts commit 20540710e83f2873707c284a0c0693f0b57156c4. Since we've given up on adding PGDLLEXPORT markers to PG_FUNCTION_INFO_V1, there's no need to remove the legacy compatibility function. I kept the documentation changes, though, as they seem appropriate anyway. --- contrib/xml2/xpath.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'contrib/xml2/xpath.c') diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 28445be369..ac28996867 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -81,6 +81,51 @@ pgxml_parser_init(PgXmlStrictness strictness) } +/* + * Returns true if document is well-formed + * + * Note: this has been superseded by a core function. We still have to + * have it in the contrib module so that existing SQL-level references + * to the function won't fail; but in normal usage with up-to-date SQL + * definitions for the contrib module, this won't be called. + */ + +PG_FUNCTION_INFO_V1(xml_is_well_formed); + +Datum +xml_is_well_formed(PG_FUNCTION_ARGS) +{ + text *t = PG_GETARG_TEXT_P(0); /* document buffer */ + bool result = false; + int32 docsize = VARSIZE(t) - VARHDRSZ; + xmlDocPtr doctree; + PgXmlErrorContext *xmlerrcxt; + + xmlerrcxt = pgxml_parser_init(PG_XML_STRICTNESS_LEGACY); + + PG_TRY(); + { + doctree = xmlParseMemory((char *) VARDATA(t), docsize); + + result = (doctree != NULL); + + if (doctree != NULL) + xmlFreeDoc(doctree); + } + PG_CATCH(); + { + pg_xml_done(xmlerrcxt, true); + + PG_RE_THROW(); + } + PG_END_TRY(); + + pg_xml_done(xmlerrcxt, false); + + PG_RETURN_BOOL(result); +} + + /* Encodes special characters (<, >, &, " and \r) as XML entities */ PG_FUNCTION_INFO_V1(xml_encode_special_chars); -- cgit v1.2.3 From 181bdb90ba1f2361aec5a621c8f1e01736f8cad2 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 6 Feb 2017 11:33:58 +0200 Subject: Fix typos in comments. Backpatch to all supported versions, where applicable, to make backpatching of future fixes go more smoothly. Josh Soref Discussion: https://www.postgresql.org/message-id/CACZqfqCf+5qRztLPgmmosr-B0Ye4srWzzw_mo4c_8_B_mtjmJQ@mail.gmail.com --- configure | 4 ++-- configure.in | 4 ++-- contrib/bloom/blvacuum.c | 2 +- contrib/cube/expected/cube.out | 4 ++-- contrib/cube/expected/cube_2.out | 4 ++-- contrib/cube/sql/cube.sql | 4 ++-- contrib/earthdistance/earthdistance--1.1.sql | 2 +- contrib/isn/ISSN.h | 2 +- contrib/isn/isn.c | 4 ++-- contrib/ltree/expected/ltree.out | 2 +- contrib/ltree/ltxtquery_io.c | 2 +- contrib/ltree/sql/ltree.sql | 2 +- contrib/pg_standby/pg_standby.c | 2 +- contrib/pg_stat_statements/pg_stat_statements.c | 2 +- contrib/pg_trgm/trgm_op.c | 6 +++--- contrib/pgcrypto/mbuf.c | 2 +- contrib/pgcrypto/pgp-mpi-internal.c | 6 +++--- contrib/pgcrypto/pgp-mpi-openssl.c | 6 +++--- contrib/postgres_fdw/expected/postgres_fdw.out | 2 +- contrib/postgres_fdw/sql/postgres_fdw.sql | 2 +- contrib/seg/seg.c | 2 +- contrib/sepgsql/selinux.c | 2 +- contrib/sepgsql/sql/label.sql | 2 +- contrib/spi/refint.c | 2 +- contrib/start-scripts/osx/PostgreSQL | 2 +- contrib/tsearch2/tsearch2--1.0.sql | 2 +- contrib/xml2/xpath.c | 2 +- src/Makefile.shlib | 2 +- src/backend/access/gist/README | 2 +- src/backend/access/hash/hashpage.c | 2 +- src/backend/access/heap/rewriteheap.c | 2 +- src/backend/access/transam/commit_ts.c | 2 +- src/backend/access/transam/xact.c | 2 +- src/backend/catalog/objectaddress.c | 2 +- src/backend/commands/amcmds.c | 2 +- src/backend/commands/dbcommands.c | 6 +++--- src/backend/commands/explain.c | 2 +- src/backend/commands/functioncmds.c | 4 ++-- src/backend/commands/indexcmds.c | 4 ++-- src/backend/commands/publicationcmds.c | 2 +- src/backend/commands/subscriptioncmds.c | 2 +- src/backend/commands/tablecmds.c | 2 +- src/backend/executor/execMain.c | 2 +- src/backend/executor/execParallel.c | 2 +- src/backend/executor/execReplication.c | 2 +- src/backend/executor/nodeAgg.c | 2 +- src/backend/executor/nodeWindowAgg.c | 2 +- src/backend/libpq/hba.c | 2 +- src/backend/optimizer/geqo/geqo_erx.c | 4 ++-- src/backend/optimizer/path/joinpath.c | 2 +- src/backend/optimizer/plan/planmain.c | 2 +- src/backend/optimizer/util/joininfo.c | 2 +- src/backend/optimizer/util/restrictinfo.c | 2 +- src/backend/parser/gram.y | 2 +- src/backend/parser/parse_utilcmd.c | 2 +- src/backend/postmaster/bgwriter.c | 2 +- src/backend/postmaster/postmaster.c | 2 +- src/backend/replication/logical/launcher.c | 8 ++++---- src/backend/replication/logical/origin.c | 4 ++-- src/backend/replication/logical/proto.c | 2 +- src/backend/replication/logical/reorderbuffer.c | 6 +++--- src/backend/replication/logical/snapbuild.c | 6 +++--- src/backend/replication/logical/worker.c | 2 +- src/backend/replication/pgoutput/pgoutput.c | 8 ++++---- src/backend/storage/ipc/latch.c | 2 +- src/backend/storage/ipc/shm_mq.c | 2 +- src/backend/storage/ipc/standby.c | 2 +- src/backend/storage/lmgr/lock.c | 2 +- src/backend/storage/lmgr/lwlock.c | 6 +++--- src/backend/storage/lmgr/predicate.c | 2 +- src/backend/storage/smgr/md.c | 2 +- src/backend/tsearch/spell.c | 2 +- src/backend/tsearch/ts_parse.c | 6 +++--- src/backend/tsearch/wparser_def.c | 2 +- src/backend/utils/adt/formatting.c | 2 +- src/backend/utils/adt/rangetypes_selfuncs.c | 2 +- src/backend/utils/adt/ruleutils.c | 2 +- src/backend/utils/adt/tsrank.c | 4 ++-- src/backend/utils/adt/windowfuncs.c | 2 +- src/backend/utils/cache/relcache.c | 2 +- src/backend/utils/fmgr/funcapi.c | 2 +- src/backend/utils/init/postinit.c | 2 +- src/backend/utils/misc/Makefile | 2 +- src/backend/utils/mmgr/freepage.c | 6 +++--- src/backend/utils/time/tqual.c | 2 +- src/bin/pg_dump/pg_backup_custom.c | 2 +- src/bin/pg_dump/pg_dump.c | 2 +- src/bin/psql/common.c | 2 +- src/bin/psql/describe.c | 6 +++--- src/include/access/visibilitymap.h | 2 +- src/include/access/xact.h | 2 +- src/include/c.h | 2 +- src/include/catalog/partition.h | 2 +- src/include/catalog/pg_subscription.h | 6 +++--- src/include/lib/simplehash.h | 4 ++-- src/include/storage/s_lock.h | 2 +- src/include/tsearch/dicts/spell.h | 2 +- src/interfaces/ecpg/ecpglib/execute.c | 2 +- src/interfaces/ecpg/pgtypeslib/datetime.c | 2 +- src/interfaces/ecpg/pgtypeslib/numeric.c | 4 ++-- src/interfaces/ecpg/preproc/ecpg.header | 2 +- src/interfaces/ecpg/preproc/ecpg.trailer | 8 ++++---- src/interfaces/ecpg/preproc/parse.pl | 2 +- src/interfaces/libpq/fe-auth.c | 2 +- src/interfaces/libpq/libpq-int.h | 4 ++-- src/interfaces/libpq/win32.c | 2 +- src/pl/plperl/ppport.h | 6 +++--- src/pl/plpython/plpy_elog.c | 2 +- src/pl/plpython/plpy_plpymodule.c | 2 +- src/pl/plpython/plpy_typeio.h | 4 ++-- src/test/isolation/specs/receipt-report.spec | 2 +- src/test/isolation/specs/two-ids.spec | 2 +- src/test/regress/expected/alter_table.out | 6 +++--- src/test/regress/expected/create_table.out | 2 +- src/test/regress/expected/indirect_toast.out | 8 ++++---- src/test/regress/expected/init_privs.out | 2 +- src/test/regress/expected/insert_conflict.out | 2 +- src/test/regress/expected/join.out | 2 +- src/test/regress/expected/matview.out | 2 +- src/test/regress/expected/plpgsql.out | 2 +- src/test/regress/expected/replica_identity.out | 2 +- src/test/regress/expected/rolenames.out | 2 +- src/test/regress/expected/rules.out | 2 +- src/test/regress/expected/tsdicts.out | 2 +- src/test/regress/sql/alter_table.sql | 6 +++--- src/test/regress/sql/create_table.sql | 2 +- src/test/regress/sql/indirect_toast.sql | 8 ++++---- src/test/regress/sql/init_privs.sql | 2 +- src/test/regress/sql/insert_conflict.sql | 2 +- src/test/regress/sql/join.sql | 2 +- src/test/regress/sql/matview.sql | 2 +- src/test/regress/sql/plpgsql.sql | 2 +- src/test/regress/sql/replica_identity.sql | 2 +- src/test/regress/sql/rolenames.sql | 2 +- src/test/regress/sql/rules.sql | 2 +- src/test/regress/sql/tsdicts.sql | 2 +- src/test/ssl/ServerSetup.pm | 2 +- 137 files changed, 195 insertions(+), 195 deletions(-) (limited to 'contrib/xml2/xpath.c') diff --git a/configure b/configure index 9a83f19821..8468417f69 100755 --- a/configure +++ b/configure @@ -7088,7 +7088,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # When Autoconf chooses install-sh as install program it tries to generate -# a relative path to it in each makefile where it subsitutes it. This clashes +# a relative path to it in each makefile where it substitutes it. This clashes # with our Makefile.global concept. This workaround helps. case $INSTALL in *install-sh*) install_bin='';; @@ -7232,7 +7232,7 @@ fi $as_echo "$MKDIR_P" >&6; } # When Autoconf chooses install-sh as mkdir -p program it tries to generate -# a relative path to it in each makefile where it subsitutes it. This clashes +# a relative path to it in each makefile where it substitutes it. This clashes # with our Makefile.global concept. This workaround helps. case $MKDIR_P in *install-sh*) MKDIR_P='\${SHELL} \${top_srcdir}/config/install-sh -c -d';; diff --git a/configure.in b/configure.in index 52e4e78471..01b618c931 100644 --- a/configure.in +++ b/configure.in @@ -887,7 +887,7 @@ fi AC_PROG_INSTALL # When Autoconf chooses install-sh as install program it tries to generate -# a relative path to it in each makefile where it subsitutes it. This clashes +# a relative path to it in each makefile where it substitutes it. This clashes # with our Makefile.global concept. This workaround helps. case $INSTALL in *install-sh*) install_bin='';; @@ -900,7 +900,7 @@ AC_PROG_LN_S AC_PROG_AWK AC_PROG_MKDIR_P # When Autoconf chooses install-sh as mkdir -p program it tries to generate -# a relative path to it in each makefile where it subsitutes it. This clashes +# a relative path to it in each makefile where it substitutes it. This clashes # with our Makefile.global concept. This workaround helps. case $MKDIR_P in *install-sh*) MKDIR_P='\${SHELL} \${top_srcdir}/config/install-sh -c -d';; diff --git a/contrib/bloom/blvacuum.c b/contrib/bloom/blvacuum.c index 807da9254e..04abd0f6b6 100644 --- a/contrib/bloom/blvacuum.c +++ b/contrib/bloom/blvacuum.c @@ -51,7 +51,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, initBloomState(&state, index); /* - * Interate over the pages. We don't care about concurrently added pages, + * Iterate over the pages. We don't care about concurrently added pages, * they can't contain tuples to delete. */ npages = RelationGetNumberOfBlocks(index); diff --git a/contrib/cube/expected/cube.out b/contrib/cube/expected/cube.out index ada54b2885..328b3b5f5d 100644 --- a/contrib/cube/expected/cube.out +++ b/contrib/cube/expected/cube.out @@ -1056,7 +1056,7 @@ SELECT cube_dim('(4,8,15,16,23),(4,8,15,16,23)'::cube); 5 (1 row) --- Test of cube_ll_coord function (retrieves LL coodinate values) +-- Test of cube_ll_coord function (retrieves LL coordinate values) -- SELECT cube_ll_coord('(-1,1),(2,-2)'::cube, 1); cube_ll_coord @@ -1112,7 +1112,7 @@ SELECT cube_ll_coord('(42,137)'::cube, 3); 0 (1 row) --- Test of cube_ur_coord function (retrieves UR coodinate values) +-- Test of cube_ur_coord function (retrieves UR coordinate values) -- SELECT cube_ur_coord('(-1,1),(2,-2)'::cube, 1); cube_ur_coord diff --git a/contrib/cube/expected/cube_2.out b/contrib/cube/expected/cube_2.out index c58614ef05..1aa5cf2f98 100644 --- a/contrib/cube/expected/cube_2.out +++ b/contrib/cube/expected/cube_2.out @@ -1056,7 +1056,7 @@ SELECT cube_dim('(4,8,15,16,23),(4,8,15,16,23)'::cube); 5 (1 row) --- Test of cube_ll_coord function (retrieves LL coodinate values) +-- Test of cube_ll_coord function (retrieves LL coordinate values) -- SELECT cube_ll_coord('(-1,1),(2,-2)'::cube, 1); cube_ll_coord @@ -1112,7 +1112,7 @@ SELECT cube_ll_coord('(42,137)'::cube, 3); 0 (1 row) --- Test of cube_ur_coord function (retrieves UR coodinate values) +-- Test of cube_ur_coord function (retrieves UR coordinate values) -- SELECT cube_ur_coord('(-1,1),(2,-2)'::cube, 1); cube_ur_coord diff --git a/contrib/cube/sql/cube.sql b/contrib/cube/sql/cube.sql index a61fba1ea8..58ea3ad811 100644 --- a/contrib/cube/sql/cube.sql +++ b/contrib/cube/sql/cube.sql @@ -256,7 +256,7 @@ SELECT cube_dim('(0,0,0)'::cube); SELECT cube_dim('(42,42,42),(42,42,42)'::cube); SELECT cube_dim('(4,8,15,16,23),(4,8,15,16,23)'::cube); --- Test of cube_ll_coord function (retrieves LL coodinate values) +-- Test of cube_ll_coord function (retrieves LL coordinate values) -- SELECT cube_ll_coord('(-1,1),(2,-2)'::cube, 1); SELECT cube_ll_coord('(-1,1),(2,-2)'::cube, 2); @@ -268,7 +268,7 @@ SELECT cube_ll_coord('(42,137)'::cube, 1); SELECT cube_ll_coord('(42,137)'::cube, 2); SELECT cube_ll_coord('(42,137)'::cube, 3); --- Test of cube_ur_coord function (retrieves UR coodinate values) +-- Test of cube_ur_coord function (retrieves UR coordinate values) -- SELECT cube_ur_coord('(-1,1),(2,-2)'::cube, 1); SELECT cube_ur_coord('(-1,1),(2,-2)'::cube, 2); diff --git a/contrib/earthdistance/earthdistance--1.1.sql b/contrib/earthdistance/earthdistance--1.1.sql index 657d328ebb..9136a54a7b 100644 --- a/contrib/earthdistance/earthdistance--1.1.sql +++ b/contrib/earthdistance/earthdistance--1.1.sql @@ -11,7 +11,7 @@ CREATE FUNCTION earth() RETURNS float8 LANGUAGE SQL IMMUTABLE PARALLEL SAFE AS 'SELECT ''6378168''::float8'; --- Astromers may want to change the earth function so that distances will be +-- Astronomers may want to change the earth function so that distances will be -- returned in degrees. To do this comment out the above definition and -- uncomment the one below. Note that doing this will break the regression -- tests. diff --git a/contrib/isn/ISSN.h b/contrib/isn/ISSN.h index 082efcff7c..585f0e2674 100644 --- a/contrib/isn/ISSN.h +++ b/contrib/isn/ISSN.h @@ -23,7 +23,7 @@ * Product 9 + 21 + 7 + 3 + 1 + 12 + 4 + 24 + 7 + 15 + 0 + 0 = 103 * 103 / 10 = 10 remainder 3 * Check digit 10 - 3 = 7 - * => 977-1144875-00-7 ?? <- suplemental number (number of the week, month, etc.) + * => 977-1144875-00-7 ?? <- supplemental number (number of the week, month, etc.) * ^^ 00 for non-daily publications (01=Monday, 02=Tuesday, ...) * * The hyphenation is always in after the four digits of the ISSN code. diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c index 9e125b83d7..c3c10e14bc 100644 --- a/contrib/isn/isn.c +++ b/contrib/isn/isn.c @@ -160,7 +160,7 @@ dehyphenate(char *bufO, char *bufI) * into bufO using the given hyphenation range TABLE. * Assumes the input string to be used is of only digits. * - * Returns the number of characters acctually hyphenated. + * Returns the number of characters actually hyphenated. */ static unsigned hyphenate(char *bufO, char *bufI, const char *(*TABLE)[2], const unsigned TABLE_index[10][2]) @@ -748,7 +748,7 @@ string2ean(const char *str, bool errorOK, ean13 *result, } else if (*aux2 == '!' && *(aux2 + 1) == '\0') { - /* the invalid check digit sufix was found, set it */ + /* the invalid check digit suffix was found, set it */ if (!magic) valid = false; magic = true; diff --git a/contrib/ltree/expected/ltree.out b/contrib/ltree/expected/ltree.out index db52069c26..3d5737d41b 100644 --- a/contrib/ltree/expected/ltree.out +++ b/contrib/ltree/expected/ltree.out @@ -1113,7 +1113,7 @@ SELECT '{a.b.c.d.e,B.df}'::ltree[] ? '{A.b.c.d.e,*.df}'; t (1 row) ---exractors +--extractors SELECT ('{3456,1.2.3.34}'::ltree[] ?@> '1.2.3.4') is null; ?column? ---------- diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c index befda1344d..32d9046258 100644 --- a/contrib/ltree/ltxtquery_io.c +++ b/contrib/ltree/ltxtquery_io.c @@ -197,7 +197,7 @@ pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag) #define STACKDEPTH 32 /* - * make polish notaion of query + * make polish notation of query */ static int32 makepol(QPRS_STATE *state) diff --git a/contrib/ltree/sql/ltree.sql b/contrib/ltree/sql/ltree.sql index b4f62e3feb..e9f74909a6 100644 --- a/contrib/ltree/sql/ltree.sql +++ b/contrib/ltree/sql/ltree.sql @@ -209,7 +209,7 @@ SELECT 'a.b.c.d.e'::ltree ? '{A.b.c.d.e, a.*}'; SELECT '{a.b.c.d.e,B.df}'::ltree[] ? '{A.b.c.d.e}'; SELECT '{a.b.c.d.e,B.df}'::ltree[] ? '{A.b.c.d.e,*.df}'; ---exractors +--extractors SELECT ('{3456,1.2.3.34}'::ltree[] ?@> '1.2.3.4') is null; SELECT '{3456,1.2.3}'::ltree[] ?@> '1.2.3.4'; SELECT '{3456,1.2.3.4}'::ltree[] ?<@ '1.2.3'; diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c index e4136f9149..e4d057e18e 100644 --- a/contrib/pg_standby/pg_standby.c +++ b/contrib/pg_standby/pg_standby.c @@ -779,7 +779,7 @@ main(int argc, char **argv) { /* * Once we have restored this file successfully we can remove some - * prior WAL files. If this restore fails we musn't remove any + * prior WAL files. If this restore fails we mustn't remove any * file because some of them will be requested again immediately * after the failed restore, or when we restart recovery. */ diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index a65b52968a..62dec8768a 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -139,7 +139,7 @@ typedef struct Counters { int64 calls; /* # of times executed */ double total_time; /* total execution time, in msec */ - double min_time; /* minimim execution time in msec */ + double min_time; /* minimum execution time in msec */ double max_time; /* maximum execution time in msec */ double mean_time; /* mean execution time in msec */ double sum_var_time; /* sum of variances in execution time in msec */ diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c index dd0f492cfa..368e7c8941 100644 --- a/contrib/pg_trgm/trgm_op.c +++ b/contrib/pg_trgm/trgm_op.c @@ -413,7 +413,7 @@ comp_ptrgm(const void *v1, const void *v2) * ulen1: count of unique trigrams of array "trg1". * len2: length of array "trg2" and array "trg2indexes". * len: length of the array "found". - * check_only: if true then only check existaince of similar search pattern in + * check_only: if true then only check existence of similar search pattern in * text. * * Returns word similarity. @@ -456,7 +456,7 @@ iterate_word_similarity(int *trg2indexes, lastpos[trgindex] = i; } - /* Adjust lower bound if this trigram is present in required substing */ + /* Adjust lower bound if this trigram is present in required substring */ if (found[trgindex]) { int prev_lower, @@ -547,7 +547,7 @@ iterate_word_similarity(int *trg2indexes, * * str1: search pattern string, of length slen1 bytes. * str2: text in which we are looking for a word, of length slen2 bytes. - * check_only: if true then only check existaince of similar search pattern in + * check_only: if true then only check existence of similar search pattern in * text. * * Returns word similarity. diff --git a/contrib/pgcrypto/mbuf.c b/contrib/pgcrypto/mbuf.c index 44d9adcd2a..73dbfbd08f 100644 --- a/contrib/pgcrypto/mbuf.c +++ b/contrib/pgcrypto/mbuf.c @@ -311,7 +311,7 @@ pullf_read_max(PullFilter *pf, int len, uint8 **data_p, uint8 *tmpbuf) } /* - * caller wants exatly len bytes and dont bother with references + * caller wants exactly len bytes and don't bother with references */ int pullf_read_fixed(PullFilter *src, int len, uint8 *dst) diff --git a/contrib/pgcrypto/pgp-mpi-internal.c b/contrib/pgcrypto/pgp-mpi-internal.c index cb70fcba6c..545009ce19 100644 --- a/contrib/pgcrypto/pgp-mpi-internal.c +++ b/contrib/pgcrypto/pgp-mpi-internal.c @@ -141,7 +141,7 @@ bn_to_mpi(mpz_t *bn) } /* - * Decide the number of bits in the random componont k + * Decide the number of bits in the random component k * * It should be in the same range as p for signing (which * is deprecated), but can be much smaller for encrypting. @@ -149,8 +149,8 @@ bn_to_mpi(mpz_t *bn) * Until I research it further, I just mimic gpg behaviour. * It has a special mapping table, for values <= 5120, * above that it uses 'arbitrary high number'. Following - * algorihm hovers 10-70 bits above gpg values. And for - * larger p, it uses gpg's algorihm. + * algorithm hovers 10-70 bits above gpg values. And for + * larger p, it uses gpg's algorithm. * * The point is - if k gets large, encryption will be * really slow. It does not matter for decryption. diff --git a/contrib/pgcrypto/pgp-mpi-openssl.c b/contrib/pgcrypto/pgp-mpi-openssl.c index 24484a6c54..afece26918 100644 --- a/contrib/pgcrypto/pgp-mpi-openssl.c +++ b/contrib/pgcrypto/pgp-mpi-openssl.c @@ -74,7 +74,7 @@ bn_to_mpi(BIGNUM *bn) } /* - * Decide the number of bits in the random componont k + * Decide the number of bits in the random component k * * It should be in the same range as p for signing (which * is deprecated), but can be much smaller for encrypting. @@ -82,8 +82,8 @@ bn_to_mpi(BIGNUM *bn) * Until I research it further, I just mimic gpg behaviour. * It has a special mapping table, for values <= 5120, * above that it uses 'arbitrary high number'. Following - * algorihm hovers 10-70 bits above gpg values. And for - * larger p, it uses gpg's algorihm. + * algorithm hovers 10-70 bits above gpg values. And for + * larger p, it uses gpg's algorithm. * * The point is - if k gets large, encryption will be * really slow. It does not matter for decryption. diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out index 3a092804a2..0b9e3e4537 100644 --- a/contrib/postgres_fdw/expected/postgres_fdw.out +++ b/contrib/postgres_fdw/expected/postgres_fdw.out @@ -2057,7 +2057,7 @@ SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM 1 (10 rows) --- non-Var items in targelist of the nullable rel of a join preventing +-- non-Var items in targetlist of the nullable rel of a join preventing -- push-down in some cases -- unable to push {ft1, ft2} EXPLAIN (VERBOSE, COSTS OFF) diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql index e19a3ef398..56b01d0490 100644 --- a/contrib/postgres_fdw/sql/postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/postgres_fdw.sql @@ -493,7 +493,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10; SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10; --- non-Var items in targelist of the nullable rel of a join preventing +-- non-Var items in targetlist of the nullable rel of a join preventing -- push-down in some cases -- unable to push {ft1, ft2} EXPLAIN (VERBOSE, COSTS OFF) diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index c6c082b8ea..895d879498 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -888,7 +888,7 @@ restore(char *result, float val, int n) if (Abs(exp) <= 4) { /* - * remove the decimal point from the mantyssa and write the digits + * remove the decimal point from the mantissa and write the digits * to the buf array */ for (p = result + sign, i = 10, dp = 0; *p != 'e'; p++, i++) diff --git a/contrib/sepgsql/selinux.c b/contrib/sepgsql/selinux.c index 3e2cfab819..7728a18333 100644 --- a/contrib/sepgsql/selinux.c +++ b/contrib/sepgsql/selinux.c @@ -23,7 +23,7 @@ * When we ask SELinux whether the required privileges are allowed or not, * we use security_compute_av(3). It needs us to represent object classes * and access vectors using 'external' codes defined in the security policy. - * It is determinded in the runtime, not build time. So, it needs an internal + * It is determined in the runtime, not build time. So, it needs an internal * service to translate object class/access vectors which we want to check * into the code which kernel want to be given. */ diff --git a/contrib/sepgsql/sql/label.sql b/contrib/sepgsql/sql/label.sql index 04085e57a4..49780b2697 100644 --- a/contrib/sepgsql/sql/label.sql +++ b/contrib/sepgsql/sql/label.sql @@ -206,7 +206,7 @@ SELECT * FROM auth_tbl; -- failed SELECT sepgsql_setcon(NULL); -- end of session SELECT sepgsql_getcon(); --- the pooler cannot touch these tables directry +-- the pooler cannot touch these tables directly SELECT * FROM foo_tbl; -- failed SELECT * FROM var_tbl; -- failed diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index 78cfedf219..208ff6103d 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -89,7 +89,7 @@ check_primary_key(PG_FUNCTION_ARGS) /* internal error */ elog(ERROR, "check_primary_key: cannot process DELETE events"); - /* If UPDATion the must check new Tuple, not old one */ + /* If UPDATE, then must check new Tuple, not old one */ else tuple = trigdata->tg_newtuple; diff --git a/contrib/start-scripts/osx/PostgreSQL b/contrib/start-scripts/osx/PostgreSQL index 9735c8c57f..7ff1d0e377 100755 --- a/contrib/start-scripts/osx/PostgreSQL +++ b/contrib/start-scripts/osx/PostgreSQL @@ -29,7 +29,7 @@ # modified by Ray Aspeitia 12-03-2003 : # added log rotation script to db startup # modified StartupParameters.plist "Provides" parameter to make it easier to -# start and stop with the SystemStarter utitlity +# start and stop with the SystemStarter utility # use the below command in order to correctly start/stop/restart PG with log rotation script: # SystemStarter [start|stop|restart] PostgreSQL diff --git a/contrib/tsearch2/tsearch2--1.0.sql b/contrib/tsearch2/tsearch2--1.0.sql index a32c5fe85b..68bb43fd7c 100644 --- a/contrib/tsearch2/tsearch2--1.0.sql +++ b/contrib/tsearch2/tsearch2--1.0.sql @@ -414,7 +414,7 @@ CREATE FUNCTION stat(text,text) LANGUAGE INTERNAL RETURNS NULL ON NULL INPUT; ---reset - just for debuging +--reset - just for debugging CREATE FUNCTION reset_tsearch() RETURNS void as 'MODULE_PATHNAME', 'tsa_reset_tsearch' diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index ac28996867..73b74c875e 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -610,7 +610,7 @@ xpath_table(PG_FUNCTION_ARGS) /* * At the moment we assume that the returned attributes make sense for the - * XPath specififed (i.e. we trust the caller). It's not fatal if they get + * XPath specified (i.e. we trust the caller). It's not fatal if they get * it wrong - the input function for the column type will raise an error * if the path result can't be converted into the correct binary * representation. diff --git a/src/Makefile.shlib b/src/Makefile.shlib index c293a34d1a..35e2dd8690 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -377,7 +377,7 @@ $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) endif -endif # PORTNAME == cgywin +endif # PORTNAME == cygwin endif # PORTNAME == cygwin || PORTNAME == win32 diff --git a/src/backend/access/gist/README b/src/backend/access/gist/README index dd4c9fa70a..02228662b8 100644 --- a/src/backend/access/gist/README +++ b/src/backend/access/gist/README @@ -28,7 +28,7 @@ The current implementation of GiST supports: The support for concurrency implemented in PostgreSQL was developed based on the paper "Access Methods for Next-Generation Database Systems" by -Marcel Kornaker: +Marcel Kornacker: http://www.sai.msu.su/~megera/postgres/gist/papers/concurrency/access-methods-for-next-generation.pdf.gz diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c index 9430794207..69676eba95 100644 --- a/src/backend/access/hash/hashpage.c +++ b/src/backend/access/hash/hashpage.c @@ -1077,7 +1077,7 @@ _hash_splitbucket_guts(Relation rel, * already moved before the split operation was previously interrupted. * * The caller must hold a pin, but no lock, on the metapage and old bucket's - * primay page buffer. The buffers are returned in the same state. (The + * primary page buffer. The buffers are returned in the same state. (The * metapage is only touched if it becomes necessary to add or remove overflow * pages.) */ diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index 90ab6f2421..c7b283c198 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -209,7 +209,7 @@ typedef struct RewriteMappingFile } RewriteMappingFile; /* - * A single In-Memeory logical rewrite mapping, hanging of + * A single In-Memory logical rewrite mapping, hanging off * RewriteMappingFile->mappings. */ typedef struct RewriteMappingDataEntry diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c index 18a5f5602c..20f60bc023 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -615,7 +615,7 @@ CommitTsParameterChange(bool newvalue, bool oldvalue) /* * Activate this module whenever necessary. - * This must happen during postmaster or standalong-backend startup, + * This must happen during postmaster or standalone-backend startup, * or during WAL replay anytime the track_commit_timestamp setting is * changed in the master. * diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index f6f136da3a..82f9a3c5c6 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -2752,7 +2752,7 @@ CommitTransactionCommand(void) * These shouldn't happen. TBLOCK_DEFAULT means the previous * StartTransactionCommand didn't set the STARTED state * appropriately, while TBLOCK_PARALLEL_INPROGRESS should be ended - * by EndParallelWorkerTranaction(), not this function. + * by EndParallelWorkerTransaction(), not this function. */ case TBLOCK_DEFAULT: case TBLOCK_PARALLEL_INPROGRESS: diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c index 2a38792ed6..a3bb2f1c0e 100644 --- a/src/backend/catalog/objectaddress.c +++ b/src/backend/catalog/objectaddress.c @@ -770,7 +770,7 @@ static void getRelationIdentity(StringInfo buffer, Oid relid, List **objname); * * Note: If the object is not found, we don't give any indication of the * reason. (It might have been a missing schema if the name was qualified, or - * an inexistant type name in case of a cast, function or operator; etc). + * a nonexistent type name in case of a cast, function or operator; etc). * Currently there is only one caller that might be interested in such info, so * we don't spend much effort here. If more callers start to care, it might be * better to add some support for that in this function. diff --git a/src/backend/commands/amcmds.c b/src/backend/commands/amcmds.c index 225e6f636c..7e0a9aa0fd 100644 --- a/src/backend/commands/amcmds.c +++ b/src/backend/commands/amcmds.c @@ -34,7 +34,7 @@ static const char *get_am_type_string(char amtype); /* - * CreateAcessMethod + * CreateAccessMethod * Registers a new access method. */ ObjectAddress diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 30000a1eeb..1ebacbc24f 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -685,7 +685,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) /* * Force synchronous commit, thus minimizing the window between - * creation of the database files and commital of the transaction. If + * creation of the database files and committal of the transaction. If * we crash before committing, we'll have a DB that's taking up disk * space but is not in pg_database, which is not good. */ @@ -955,7 +955,7 @@ dropdb(const char *dbname, bool missing_ok) /* * Force synchronous commit, thus minimizing the window between removal of - * the database files and commital of the transaction. If we crash before + * the database files and committal of the transaction. If we crash before * committing, we'll have a DB that's gone on disk but still there * according to pg_database, which is not good. */ @@ -1309,7 +1309,7 @@ movedb(const char *dbname, const char *tblspcname) /* * Force synchronous commit, thus minimizing the window between - * copying the database files and commital of the transaction. If we + * copying the database files and committal of the transaction. If we * crash before committing, we'll leave an orphaned set of files on * disk, which is not fatal but not good either. */ diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 0a67be031b..c9e0a3e42d 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -3401,7 +3401,7 @@ ExplainYAMLLineStarting(ExplainState *es) } /* - * YAML is a superset of JSON; unfortuantely, the YAML quoting rules are + * YAML is a superset of JSON; unfortunately, the YAML quoting rules are * ridiculously complicated -- as documented in sections 5.3 and 7.3.3 of * http://yaml.org/spec/1.2/spec.html -- so we chose to just quote everything. * Empty strings, strings with leading or trailing whitespace, and strings diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index dd83858b3d..8b1285a542 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -1040,7 +1040,7 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt) } else { - /* store SQL NULL instead of emtpy array */ + /* store SQL NULL instead of empty array */ trftypes = NULL; } @@ -1441,7 +1441,7 @@ CreateCast(CreateCastStmt *stmt) (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cast will be ignored because the target data type is a domain"))); - /* Detemine the cast method */ + /* Determine the cast method */ if (stmt->func != NULL) castmethod = COERCION_METHOD_FUNCTION; else if (stmt->inout) diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index ed6136c153..f4814c095b 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -99,7 +99,7 @@ static void RangeVarCallbackForReindexIndex(const RangeVar *relation, * Errors arising from the attribute list still apply. * * Most column type changes that can skip a table rewrite do not invalidate - * indexes. We ackowledge this when all operator classes, collations and + * indexes. We acknowledge this when all operator classes, collations and * exclusion operators match. Though we could further permit intra-opfamily * changes for btree and hash indexes, that adds subtle complexity with no * concrete benefit for core types. @@ -965,7 +965,7 @@ CheckMutability(Expr *expr) * indxpath.c could do something with. However, that seems overly * restrictive. One useful application of partial indexes is to apply * a UNIQUE constraint across a subset of a table, and in that scenario - * any evaluatable predicate will work. So accept any predicate here + * any evaluable predicate will work. So accept any predicate here * (except ones requiring a plan), and let indxpath.c fend for itself. */ static void diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c index 3fe1d15052..04f83e0a2e 100644 --- a/src/backend/commands/publicationcmds.c +++ b/src/backend/commands/publicationcmds.c @@ -525,7 +525,7 @@ OpenTableList(List *tables) myrelid = RelationGetRelid(rel); /* * filter out duplicates when user specifies "foo, foo" - * Note that this algrithm is know to not be very effective (O(N^2)) + * Note that this algorithm is know to not be very effective (O(N^2)) * but given that it only works on list of tables given to us by user * it's deemed acceptable. */ diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index 4353e14e1b..ab21e64b48 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -474,7 +474,7 @@ DropSubscription(DropSubscriptionStmt *stmt) InvokeObjectDropHook(SubscriptionRelationId, subid, 0); /* - * Lock the subscription so noboby else can do anything with it + * Lock the subscription so nobody else can do anything with it * (including the replication workers). */ LockSharedObject(SubscriptionRelationId, subid, 0, AccessExclusiveLock); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 878b48d39e..37a4c4a3d6 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -6630,7 +6630,7 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, /* * Check if ONLY was specified with ALTER TABLE. If so, allow the - * contraint creation only if there are no children currently. Error out + * constraint creation only if there are no children currently. Error out * otherwise. */ if (!recurse && children != NIL) diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index ce6600bde7..a66639178a 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1261,7 +1261,7 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo, resultRelInfo->ri_projectReturning = NULL; /* - * If partition_root has been specified, that means we are builiding the + * If partition_root has been specified, that means we are building the * ResultRelationInfo for one of its leaf partitions. In that case, we * need *not* initialize the leaf partition's constraint, but rather the * the partition_root's (if any). We must do that explicitly like this, diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index e01fe6da96..fe87c9ae71 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -533,7 +533,7 @@ ExecParallelRetrieveInstrumentation(PlanState *planstate, int plan_node_id = planstate->plan->plan_node_id; MemoryContext oldcontext; - /* Find the instumentation for this node. */ + /* Find the instrumentation for this node. */ for (i = 0; i < instrumentation->num_plan_nodes; ++i) if (instrumentation->plan_node_id[i] == plan_node_id) break; diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index a8bd5832c9..ebf3f6b3c9 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -391,7 +391,7 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot) if (rel->rd_att->constr) ExecConstraints(resultRelInfo, slot, slot, estate); - /* Store the slot into tuple that we can insett. */ + /* Store the slot into tuple that we can inspect. */ tuple = ExecMaterializeSlot(slot); /* OK, store the tuple and create index entries for it */ diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 5c6079af80..aa08152350 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -304,7 +304,7 @@ typedef struct AggStatePerTransData /* * Slots for holding the evaluated input arguments. These are set up * during ExecInitAgg() and then used for each input row requiring - * procesessing besides what's done in AggState->evalproj. + * processing besides what's done in AggState->evalproj. */ TupleTableSlot *sortslot; /* current input tuple */ TupleTableSlot *uniqslot; /* used for multi-column DISTINCT */ diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c index 6ac6b83cdd..2a123e8452 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -354,7 +354,7 @@ advance_windowaggregate(WindowAggState *winstate, /* * We must track the number of rows included in transValue, since to - * remove the last input, advance_windowaggregate_base() musn't call the + * remove the last input, advance_windowaggregate_base() mustn't call the * inverse transition function, but simply reset transValue back to its * initial value. */ diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 95ded23791..be63a4bc63 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -109,7 +109,7 @@ static MemoryContext parsed_hba_context = NULL; * * NOTE: the IdentLine structs can contain pre-compiled regular expressions * that live outside the memory context. Before destroying or resetting the - * memory context, they need to be expliticly free'd. + * memory context, they need to be explicitly free'd. */ static List *parsed_ident_lines = NIL; static MemoryContext parsed_ident_context = NULL; diff --git a/src/backend/optimizer/geqo/geqo_erx.c b/src/backend/optimizer/geqo/geqo_erx.c index 1a43ab7288..023abf70e2 100644 --- a/src/backend/optimizer/geqo/geqo_erx.c +++ b/src/backend/optimizer/geqo/geqo_erx.c @@ -111,7 +111,7 @@ gimme_edge_table(PlannerInfo *root, Gene *tour1, Gene *tour2, for (index1 = 0; index1 < num_gene; index1++) { /* - * presume the tour is circular, i.e. 1->2, 2->3, 3->1 this operaton + * presume the tour is circular, i.e. 1->2, 2->3, 3->1 this operation * maps n back to 1 */ @@ -314,7 +314,7 @@ gimme_gene(PlannerInfo *root, Edge edge, Edge *edge_table) /* * give priority to candidates with fewest remaining unused edges; * find out what the minimum number of unused edges is - * (minimum_edges); if there is more than one cadidate with the + * (minimum_edges); if there is more than one candidate with the * minimum number of unused edges keep count of this number * (minimum_count); */ diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index 7c30ec6fb9..2897245883 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -1618,7 +1618,7 @@ select_mergejoin_clauses(PlannerInfo *root, /* * Insist that each side have a non-redundant eclass. This * restriction is needed because various bits of the planner expect - * that each clause in a merge be associatable with some pathkey in a + * that each clause in a merge be associable with some pathkey in a * canonical pathkey list, but redundant eclasses can't appear in * canonical sort orderings. (XXX it might be worth relaxing this, * but not enough time to address it for 8.3.) diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index e8807591a0..3c58d0596c 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -195,7 +195,7 @@ query_planner(PlannerInfo *root, List *tlist, /* * Now distribute "placeholders" to base rels as needed. This has to be * done after join removal because removal could change whether a - * placeholder is evaluatable at a base rel. + * placeholder is evaluable at a base rel. */ add_placeholders_to_base_rels(root); diff --git a/src/backend/optimizer/util/joininfo.c b/src/backend/optimizer/util/joininfo.c index 6d84477f86..62629ee7d8 100644 --- a/src/backend/optimizer/util/joininfo.c +++ b/src/backend/optimizer/util/joininfo.c @@ -24,7 +24,7 @@ * Detect whether there is a joinclause that involves * the two given relations. * - * Note: the joinclause does not have to be evaluatable with only these two + * Note: the joinclause does not have to be evaluable with only these two * relations. This is intentional. For example consider * SELECT * FROM a, b, c WHERE a.x = (b.y + c.z) * If a is much larger than the other tables, it may be worthwhile to diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c index 8f10520f81..045b5cf539 100644 --- a/src/backend/optimizer/util/restrictinfo.c +++ b/src/backend/optimizer/util/restrictinfo.c @@ -515,7 +515,7 @@ join_clause_is_movable_into(RestrictInfo *rinfo, Relids currentrelids, Relids current_and_outer) { - /* Clause must be evaluatable given available context */ + /* Clause must be evaluable given available context */ if (!bms_is_subset(rinfo->clause_relids, current_and_outer)) return false; diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index a4edea08a3..cf97be512d 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11312,7 +11312,7 @@ table_ref: relation_expr opt_alias_clause n->lateral = true; n->subquery = $2; n->alias = $3; - /* same coment as above */ + /* same comment as above */ if ($3 == NULL) { if (IsA($2, SelectStmt) && diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 0e4e7a8c80..8d1939445b 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -3050,7 +3050,7 @@ transformAttachPartition(CreateStmtContext *cxt, PartitionCmd *cmd) errmsg("\"%s\" is not partitioned", RelationGetRelationName(parentRel)))); - /* tranform the values */ + /* transform the values */ Assert(RelationGetPartitionKey(parentRel) != NULL); cxt->partbound = transformPartitionBound(cxt->pstate, parentRel, cmd->bound); diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index 40819824ad..dcb4cf249c 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -211,7 +211,7 @@ BackgroundWriterMain(void) /* Flush any leaked data in the top-level context */ MemoryContextResetAndDeleteChildren(bgwriter_context); - /* re-initilialize to avoid repeated errors causing problems */ + /* re-initialize to avoid repeated errors causing problems */ WritebackContextInit(&wb_context, &bgwriter_flush_after); /* Now we can allow interrupts again */ diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 91ccbe78c0..271c492000 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -5156,7 +5156,7 @@ RandomCancelKey(int32 *cancel_key) } /* - * Count up number of child processes of specified types (dead_end chidren + * Count up number of child processes of specified types (dead_end children * are always excluded). */ static int diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c index d222cff708..e9ce061e83 100644 --- a/src/backend/replication/logical/launcher.c +++ b/src/backend/replication/logical/launcher.c @@ -170,7 +170,7 @@ WaitForReplicationWorkerAttach(LogicalRepWorker *worker, /* * Worker started and attached to our shmem. This check is safe - * because only laucher ever starts the workers, so nobody can steal + * because only launcher ever starts the workers, so nobody can steal * the worker slot. */ if (status == BGWH_STARTED && worker->proc) @@ -180,7 +180,7 @@ WaitForReplicationWorkerAttach(LogicalRepWorker *worker, return false; /* - * We need timeout because we generaly don't get notified via latch + * We need timeout because we generally don't get notified via latch * about the worker attach. */ rc = WaitLatch(MyLatch, @@ -533,7 +533,7 @@ AtCommit_ApplyLauncher(void) /* * Request wakeup of the launcher on commit of the transaction. * - * This is used to send launcher signal to stop sleeping and proccess the + * This is used to send launcher signal to stop sleeping and process the * subscriptions when current transaction commits. Should be used when new * tuple was added to the pg_subscription catalog. */ @@ -638,7 +638,7 @@ ApplyLauncherMain(Datum main_arg) else { /* - * The wait in previous cycle was interruped in less than + * The wait in previous cycle was interrupted in less than * wal_retrieve_retry_interval since last worker was started, * this usually means crash of the worker, so we should retry * in wal_retrieve_retry_interval again. diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c index ade80d407f..bf84c68a0c 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -1250,7 +1250,7 @@ pg_replication_origin_session_is_setup(PG_FUNCTION_ARGS) * Return the replication progress for origin setup in the current session. * * If 'flush' is set to true it is ensured that the returned value corresponds - * to a local transaction that has been flushed. this is useful if asychronous + * to a local transaction that has been flushed. this is useful if asynchronous * commits are used when replaying replicated transactions. */ Datum @@ -1336,7 +1336,7 @@ pg_replication_origin_advance(PG_FUNCTION_ARGS) * Return the replication progress for an individual replication origin. * * If 'flush' is set to true it is ensured that the returned value corresponds - * to a local transaction that has been flushed. this is useful if asychronous + * to a local transaction that has been flushed. this is useful if asynchronous * commits are used when replaying replicated transactions. */ Datum diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c index 1f30de606a..142cd993cd 100644 --- a/src/backend/replication/logical/proto.c +++ b/src/backend/replication/logical/proto.c @@ -539,7 +539,7 @@ logicalrep_write_attrs(StringInfo out, Relation rel) if (att->attisdropped) continue; - /* REPLICA IDENTITY FULL means all colums are sent as part of key. */ + /* REPLICA IDENTITY FULL means all columns are sent as part of key. */ if (replidentfull || bms_is_member(att->attnum - FirstLowInvalidHeapAttributeNumber, idattrs)) diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index d805ef4fb7..7dc97fa796 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -1714,7 +1714,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid, * * NB: Transactions handled here have to have actively aborted (i.e. have * produced an abort record). Implicitly aborted transactions are handled via - * ReorderBufferAbortOld(); transactions we're just not interesteded in, but + * ReorderBufferAbortOld(); transactions we're just not interested in, but * which have committed are handled in ReorderBufferForget(). * * This function purges this transaction and its contents from memory and @@ -1782,7 +1782,7 @@ ReorderBufferAbortOld(ReorderBuffer *rb, TransactionId oldestRunningXid) * toplevel xid. * * This is significantly different to ReorderBufferAbort() because - * transactions that have committed need to be treated differenly from aborted + * transactions that have committed need to be treated differently from aborted * ones since they may have modified the catalog. * * Note that this is only allowed to be called in the moment a transaction @@ -2660,7 +2660,7 @@ StartupReorderBuffer(void) /* * ok, has to be a surviving logical slot, iterate and delete - * everythign starting with xid-* + * everything starting with xid-* */ sprintf(path, "pg_replslot/%s", logical_de->d_name); diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 1e02aa9bd8..62020b6ed0 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -614,7 +614,7 @@ SnapBuildGetOrBuildSnapshot(SnapBuild *builder, TransactionId xid) if (builder->snapshot == NULL) { builder->snapshot = SnapBuildBuildSnapshot(builder, xid); - /* inrease refcount for the snapshot builder */ + /* increase refcount for the snapshot builder */ SnapBuildSnapIncRefcount(builder->snapshot); } @@ -678,7 +678,7 @@ SnapBuildProcessChange(SnapBuild *builder, TransactionId xid, XLogRecPtr lsn) if (builder->snapshot == NULL) { builder->snapshot = SnapBuildBuildSnapshot(builder, xid); - /* inrease refcount for the snapshot builder */ + /* increase refcount for the snapshot builder */ SnapBuildSnapIncRefcount(builder->snapshot); } @@ -911,7 +911,7 @@ SnapBuildEndTxn(SnapBuild *builder, XLogRecPtr lsn, TransactionId xid) { /* * None of the originally running transaction is running anymore, - * so our incrementaly built snapshot now is consistent. + * so our incrementally built snapshot now is consistent. */ ereport(LOG, (errmsg("logical decoding found consistent point at %X/%X", diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 9383960da7..0b19feca40 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -327,7 +327,7 @@ slot_store_cstrings(TupleTableSlot *slot, LogicalRepRelMapEntry *rel, /* * Modify slot with user data provided as C strigs. * This is somewhat similar to heap_modify_tuple but also calls the type - * input fuction on the user data as the input is the text representation + * input function on the user data as the input is the text representation * of the types. */ static void diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 08c30af88a..0ceb4be375 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -172,7 +172,7 @@ pgoutput_startup(LogicalDecodingContext * ctx, OutputPluginOptions *opt, &data->protocol_version, &data->publication_names); - /* Check if we support requested protol */ + /* Check if we support requested protocol */ if (data->protocol_version != LOGICALREP_PROTO_VERSION_NUM) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -424,7 +424,7 @@ publication_invalidation_cb(Datum arg, int cacheid, uint32 hashvalue) /* * Initialize the relation schema sync cache for a decoding session. * - * The hash table is destoyed at the end of a decoding session. While + * The hash table is destroyed at the end of a decoding session. While * relcache invalidations still exist and will still be invoked, they * will just see the null hash table global and take no action. */ @@ -540,7 +540,7 @@ rel_sync_cache_relation_cb(Datum arg, Oid relid) /* * We can get here if the plugin was used in SQL interface as the - * RelSchemaSyncCache is detroyed when the decoding finishes, but there + * RelSchemaSyncCache is destroyed when the decoding finishes, but there * is no way to unregister the relcache invalidation callback. */ if (RelationSyncCache == NULL) @@ -580,7 +580,7 @@ rel_sync_cache_publication_cb(Datum arg, int cacheid, uint32 hashvalue) /* * We can get here if the plugin was used in SQL interface as the - * RelSchemaSyncCache is detroyed when the decoding finishes, but there + * RelSchemaSyncCache is destroyed when the decoding finishes, but there * is no way to unregister the relcache invalidation callback. */ if (RelationSyncCache == NULL) diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d45a41d863..0079ba567f 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -860,7 +860,7 @@ WaitEventAdjustWin32(WaitEventSet *set, WaitEvent *event) * reached. At most nevents occurred events are returned. * * If timeout = -1, block until an event occurs; if 0, check sockets for - * readiness, but don't block; if > 0, block for at most timeout miliseconds. + * readiness, but don't block; if > 0, block for at most timeout milliseconds. * * Returns the number of events occurred, or 0 if the timeout was reached. * diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c index 32b4d3d5d4..f5bf807cd6 100644 --- a/src/backend/storage/ipc/shm_mq.c +++ b/src/backend/storage/ipc/shm_mq.c @@ -501,7 +501,7 @@ shm_mq_sendv(shm_mq_handle *mqh, shm_mq_iovec *iov, int iovcnt, bool nowait) * it will point to a temporary buffer. This mostly avoids data copying in * the hoped-for case where messages are short compared to the buffer size, * while still allowing longer messages. In either case, the return value - * remains valid until the next receive operation is perfomed on the queue. + * remains valid until the next receive operation is performed on the queue. * * When nowait = false, we'll wait on our process latch when the ring buffer * is empty and we have not yet received a full message. The sender will diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c index 6532240dd1..6259070722 100644 --- a/src/backend/storage/ipc/standby.c +++ b/src/backend/storage/ipc/standby.c @@ -967,7 +967,7 @@ LogStandbySnapshot(void) * similar. We keep them separate because xl_xact_running_xacts is a * contiguous chunk of memory and never exists fully until it is assembled in * WAL. The inserted records are marked as not being important for durability, - * to avoid triggering superflous checkpoint / archiving activity. + * to avoid triggering superfluous checkpoint / archiving activity. */ static XLogRecPtr LogCurrentRunningXacts(RunningTransactions CurrRunningXacts) diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index e9703f1866..ad64a79fa1 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -2778,7 +2778,7 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode) vxids = (VirtualTransactionId *) palloc0(sizeof(VirtualTransactionId) * (MaxBackends + 1)); - /* Compute hash code and partiton lock, and look up conflicting modes. */ + /* Compute hash code and partition lock, and look up conflicting modes. */ hashcode = LockTagHashCode(locktag); partitionLock = LockHashPartitionLock(hashcode); conflictMask = lockMethodTable->conflictTab[lockmode]; diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index c196bb8205..ab81d94b51 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -781,7 +781,7 @@ LWLockAttemptLock(LWLock *lock, LWLockMode mode) return false; } else - return true; /* someobdy else has the lock */ + return true; /* somebody else has the lock */ } } pg_unreachable(); @@ -953,7 +953,7 @@ LWLockWakeup(LWLock *lock) * that happens before the list unlink happens, the list would end up * being corrupted. * - * The barrier pairs with the LWLockWaitListLock() when enqueueing for + * The barrier pairs with the LWLockWaitListLock() when enqueuing for * another lock. */ pg_write_barrier(); @@ -1029,7 +1029,7 @@ LWLockDequeueSelf(LWLock *lock) /* * Can't just remove ourselves from the list, but we need to iterate over - * all entries as somebody else could have unqueued us. + * all entries as somebody else could have dequeued us. */ proclist_foreach_modify(iter, &lock->waiters, lwWaitLink) { diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index 9183764ca7..7aa719d612 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -3193,7 +3193,7 @@ ReleasePredicateLocks(bool isCommit) /* * We can't trust XactReadOnly here, because a transaction which started * as READ WRITE can show as READ ONLY later, e.g., within - * substransactions. We want to flag a transaction as READ ONLY if it + * subtransactions. We want to flag a transaction as READ ONLY if it * commits without writing so that de facto READ ONLY transactions get the * benefit of some RO optimizations, so we will use this local variable to * get some cleanup logic right which is based on whether the transaction diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 1d9384ef91..6c17b54f0d 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -1728,7 +1728,7 @@ _fdvec_resize(SMgrRelation reln, else { /* - * It doesn't seem worthwile complicating the code by having a more + * It doesn't seem worthwhile complicating the code by having a more * aggressive growth strategy here; the number of segments doesn't * grow that fast, and the memory context internally will sometimes * avoid doing an actual reallocation. diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c index 1c1b04c49e..c1e194a8f5 100644 --- a/src/backend/tsearch/spell.c +++ b/src/backend/tsearch/spell.c @@ -37,7 +37,7 @@ * Spell field. The AffixData field is initialized if AF parameter is not * defined. * - NISortAffixes(): - * - builds a list of compond affixes from the affix list and stores it + * - builds a list of compound affixes from the affix list and stores it * in the CompoundAffix. * - builds prefix trees (Trie) from the affix list for prefixes and suffixes * and stores them in Suffix and Prefix fields. diff --git a/src/backend/tsearch/ts_parse.c b/src/backend/tsearch/ts_parse.c index e0c9ffb7f4..b612fb0e2c 100644 --- a/src/backend/tsearch/ts_parse.c +++ b/src/backend/tsearch/ts_parse.c @@ -179,7 +179,7 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem) if (ld->curDictId == InvalidOid) { /* - * usial mode: dictionary wants only one word, but we should keep in + * usual mode: dictionary wants only one word, but we should keep in * mind that we should go through all stack */ @@ -272,7 +272,7 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem) /* * We should be sure that current type of lexeme is recognized - * by our dictinonary: we just check is it exist in list of + * by our dictionary: we just check is it exist in list of * dictionaries ? */ for (i = 0; i < map->len && !dictExists; i++) @@ -627,7 +627,7 @@ generateHeadline(HeadlineParsedText *prs) /* start of a new fragment */ infrag = 1; numfragments++; - /* add a fragment delimitor if this is after the first one */ + /* add a fragment delimiter if this is after the first one */ if (numfragments > 1) { memcpy(ptr, prs->fragdelim, prs->fragdelimlen); diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c index 6586760f15..bb7edc1516 100644 --- a/src/backend/tsearch/wparser_def.c +++ b/src/backend/tsearch/wparser_def.c @@ -2445,7 +2445,7 @@ mark_hl_words(HeadlineParsedText *prs, TSQuery query, int highlight, break; } if (curlen < min_words && i >= prs->curwords) - { /* got end of text and our cover is shoter + { /* got end of text and our cover is shorter * than min_words */ for (i = p - 1; i >= 0; i--) { diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 16a7954ec4..4f3d8a1189 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -2265,7 +2265,7 @@ seq_search(char *name, const char *const * array, int type, int max, int *len) for (last = 0, a = array; *a != NULL; a++) { - /* comperate first chars */ + /* compare first chars */ if (*name != **a) continue; diff --git a/src/backend/utils/adt/rangetypes_selfuncs.c b/src/backend/utils/adt/rangetypes_selfuncs.c index cf6ecc4cf3..2997edd672 100644 --- a/src/backend/utils/adt/rangetypes_selfuncs.c +++ b/src/backend/utils/adt/rangetypes_selfuncs.c @@ -533,7 +533,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata, { /* * Lower bound no longer matters. Just estimate the fraction - * with an upper bound <= const uppert bound + * with an upper bound <= const upper bound */ hist_selec = calc_hist_selectivity_scalar(typcache, &const_upper, diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index f26175ec44..f355954b53 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -2687,7 +2687,7 @@ is_input_argument(int nth, const char *argmodes) } /* - * Append used transformated types to specified buffer + * Append used transformed types to specified buffer */ static void print_function_trftypes(StringInfo buf, HeapTuple proctup) diff --git a/src/backend/utils/adt/tsrank.c b/src/backend/utils/adt/tsrank.c index 9b2cd6df41..76e5e541b6 100644 --- a/src/backend/utils/adt/tsrank.c +++ b/src/backend/utils/adt/tsrank.c @@ -899,7 +899,7 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method) /* * if doc are big enough then ext.q may be equal to ext.p due to limit - * of posional information. In this case we approximate number of + * of positional information. In this case we approximate number of * noise word as half cover's length */ nNoise = (ext.q - ext.p) - (ext.end - ext.begin); @@ -908,7 +908,7 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method) Wdoc += Cpos / ((double) (1 + nNoise)); CurExtPos = ((double) (ext.q + ext.p)) / 2.0; - if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent devision by + if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent division by * zero in a case of multiple lexize */ ) SumDist += 1.0 / (CurExtPos - PrevExtPos); diff --git a/src/backend/utils/adt/windowfuncs.c b/src/backend/utils/adt/windowfuncs.c index 4e714cd5bf..d86ad703da 100644 --- a/src/backend/utils/adt/windowfuncs.c +++ b/src/backend/utils/adt/windowfuncs.c @@ -342,7 +342,7 @@ window_lag(PG_FUNCTION_ARGS) /* * lag_with_offset - * returns the value of VE evelulated on a row that is OFFSET + * returns the value of VE evaluated on a row that is OFFSET * rows before the current row within a partition, * per spec. */ diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 8a7c560e46..4dd2e2b2c6 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -1433,7 +1433,7 @@ RelationInitPhysicalAddr(Relation relation) * points to the current file since the older file will be gone (or * truncated). The new file will still contain older rows so lookups * in them will work correctly. This wouldn't work correctly if - * rewrites were allowed to change the schema in a noncompatible way, + * rewrites were allowed to change the schema in an incompatible way, * but those are prevented both on catalog tables and on user tables * declared as additional catalog tables. */ diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c index c55da54878..af08f102fe 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -879,7 +879,7 @@ get_func_arg_info(HeapTuple procTup, /* * get_func_trftypes * - * Returns a number of transformated types used by function. + * Returns the number of transformed types used by function. */ int get_func_trftypes(HeapTuple procTup, diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 4d0a2a7bed..9f938f2d27 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -1108,7 +1108,7 @@ process_settings(Oid databaseid, Oid roleid) relsetting = heap_open(DbRoleSettingRelationId, AccessShareLock); - /* read all the settings under the same snapsot for efficiency */ + /* read all the settings under the same snapshot for efficiency */ snapshot = RegisterSnapshot(GetCatalogSnapshot(DbRoleSettingRelationId)); /* Later settings are ignored if set earlier. */ diff --git a/src/backend/utils/misc/Makefile b/src/backend/utils/misc/Makefile index 0ad1b8b595..45cdf76ec2 100644 --- a/src/backend/utils/misc/Makefile +++ b/src/backend/utils/misc/Makefile @@ -19,7 +19,7 @@ OBJS = backend_random.o guc.o help_config.o pg_config.o pg_controldata.o \ tzparser.o # This location might depend on the installation directories. Therefore -# we can't subsitute it into pg_config.h. +# we can't substitute it into pg_config.h. ifdef krb_srvtab override CPPFLAGS += -DPG_KRB_SRVTAB='"$(krb_srvtab)"' endif diff --git a/src/backend/utils/mmgr/freepage.c b/src/backend/utils/mmgr/freepage.c index 230756e0cd..2cd758178c 100644 --- a/src/backend/utils/mmgr/freepage.c +++ b/src/backend/utils/mmgr/freepage.c @@ -318,7 +318,7 @@ sum_free_pages(FreePageManager *fpm) /* * Compute the size of the largest run of pages that the user could - * succesfully get. + * successfully get. */ static Size FreePageManagerLargestContiguous(FreePageManager *fpm) @@ -360,7 +360,7 @@ FreePageManagerLargestContiguous(FreePageManager *fpm) /* * Recompute the size of the largest run of pages that the user could - * succesfully get, if it has been marked dirty. + * successfully get, if it has been marked dirty. */ static void FreePageManagerUpdateLargest(FreePageManager *fpm) @@ -1704,7 +1704,7 @@ FreePageManagerPutInternal(FreePageManager *fpm, Size first_page, Size npages, * The act of allocating pages for use in constructing our btree * should never cause any page to become more full, so the new * split depth should be no greater than the old one, and perhaps - * less if we fortutiously allocated a chunk that freed up a slot + * less if we fortuitously allocated a chunk that freed up a slot * on the page we need to update. */ Assert(result.split_pages <= fpm->btree_recycle_count); diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c index 053a6d1c70..703bdcedaf 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/utils/time/tqual.c @@ -1625,7 +1625,7 @@ HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple) } /* - * check whether the transaciont id 'xid' is in the pre-sorted array 'xip'. + * check whether the transaction id 'xid' is in the pre-sorted array 'xip'. */ static bool TransactionIdInArray(TransactionId xid, TransactionId *xip, Size num) diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index 5388c08b29..5737608f9e 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -198,7 +198,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH) * * Optional. * - * Set up extrac format-related TOC data. + * Set up extract format-related TOC data. */ static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 35ac05e851..4d22802912 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -3500,7 +3500,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables) resetPQExpBuffer(query); - /* Get the publication memebership for the table. */ + /* Get the publication membership for the table. */ appendPQExpBuffer(query, "SELECT pr.tableoid, pr.oid, p.pubname " "FROM pg_catalog.pg_publication_rel pr," diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 6e3acdc416..5349c39411 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -828,7 +828,7 @@ StoreQueryTuple(const PGresult *result) char *varname; char *value; - /* concate prefix and column name */ + /* concatenate prefix and column name */ varname = psprintf("%s%s", pset.gset_prefix, colname); if (!PQgetisnull(result, 0, i)) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index c501168d8c..e2e4cbcc08 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2127,7 +2127,7 @@ describeOneTableDetails(const char *schemaname, printTableAddFooter(&cont, _("Check constraints:")); for (i = 0; i < tuples; i++) { - /* untranslated contraint name and def */ + /* untranslated constraint name and def */ printfPQExpBuffer(&buf, " \"%s\" %s", PQgetvalue(result, i, 0), PQgetvalue(result, i, 1)); @@ -3197,7 +3197,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys if (verbose) { /* - * As of PostgreSQL 9.0, use pg_table_size() to show a more acurate + * As of PostgreSQL 9.0, use pg_table_size() to show a more accurate * size of a table, including FSM, VM and TOAST tables. */ if (pset.sversion >= 90000) @@ -5108,7 +5108,7 @@ describeSubscriptions(const char *pattern, bool verbose) gettext_noop("Conninfo")); } - /* Only display subscritpions in current database. */ + /* Only display subscriptions in current database. */ appendPQExpBufferStr(&buf, "FROM pg_catalog.pg_subscription\n" "WHERE subdbid = (SELECT oid\n" diff --git a/src/include/access/visibilitymap.h b/src/include/access/visibilitymap.h index 7a237d7569..a3796f2902 100644 --- a/src/include/access/visibilitymap.h +++ b/src/include/access/visibilitymap.h @@ -26,7 +26,7 @@ #define VISIBILITYMAP_ALL_VISIBLE 0x01 #define VISIBILITYMAP_ALL_FROZEN 0x02 #define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid - * visiblitymap flags bits */ + * visibilitymap flags bits */ /* Macros for visibilitymap test */ #define VM_ALL_VISIBLE(r, b, v) \ diff --git a/src/include/access/xact.h b/src/include/access/xact.h index 4df6529ea0..e7d11913d1 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -65,7 +65,7 @@ typedef enum * apply */ } SyncCommitLevel; -/* Define the default setting for synchonous_commit */ +/* Define the default setting for synchronous_commit */ #define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH /* Synchronous commit level */ diff --git a/src/include/c.h b/src/include/c.h index a2c043adfb..91e5baa969 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -989,7 +989,7 @@ typedef NameData *Name; /* gettext domain name mangling */ /* - * To better support parallel installations of major PostgeSQL + * To better support parallel installations of major PostgreSQL * versions as well as parallel installations of major library soname * versions, we mangle the gettext domain name by appending those * version numbers. The coding rule ought to be that wherever the diff --git a/src/include/catalog/partition.h b/src/include/catalog/partition.h index 93cb1686bd..b195d1a5ab 100644 --- a/src/include/catalog/partition.h +++ b/src/include/catalog/partition.h @@ -41,7 +41,7 @@ typedef struct PartitionDescData *PartitionDesc; /*----------------------- * PartitionDispatch - information about one partitioned table in a partition - * hiearchy required to route a tuple to one of its partitions + * hierarchy required to route a tuple to one of its partitions * * reldesc Relation descriptor of the table * key Partition key information of the table diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h index cf30bf90db..75b618accd 100644 --- a/src/include/catalog/pg_subscription.h +++ b/src/include/catalog/pg_subscription.h @@ -23,7 +23,7 @@ #define SubscriptionRelation_Rowtype_Id 6101 /* - * Technicaly, the subscriptions live inside the database, so a shared catalog + * Technically, the subscriptions live inside the database, so a shared catalog * seems weird, but the replication launcher process needs to access all of * them to be able to start the workers, so we have to put them in a shared, * nailed catalog. @@ -35,7 +35,7 @@ CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHE Oid subowner; /* Owner of the subscription */ - bool subenabled; /* True if the subsription is enabled + bool subenabled; /* True if the subscription is enabled * (the worker should be running) */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ @@ -65,7 +65,7 @@ typedef FormData_pg_subscription *Form_pg_subscription; typedef struct Subscription { Oid oid; /* Oid of the subscription */ - Oid dbid; /* Oid of the database which dubscription is in */ + Oid dbid; /* Oid of the database which subscription is in */ char *name; /* Name of the subscription */ Oid owner; /* Oid of the subscription owner */ bool enabled; /* Indicates if the subscription is enabled */ diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 12aedbc384..72e18499c0 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -345,7 +345,7 @@ SH_GROW(SH_TYPE *tb, uint32 newsize) * we need. We neither want tb->members increased, nor do we need to do * deal with deleted elements, nor do we need to compare keys. So a * special-cased implementation is lot faster. As resizing can be time - * consuming and frequent, that's worthwile to optimize. + * consuming and frequent, that's worthwhile to optimize. * * To be able to simply move entries over, we have to start not at the * first bucket (i.e olddata[0]), but find the first bucket that's either @@ -620,7 +620,7 @@ SH_DELETE(SH_TYPE *tb, SH_KEY_TYPE key) /* * Backward shift following elements till either an empty element - * or an element at its optimal position is encounterered. + * or an element at its optimal position is encountered. * * While that sounds expensive, the average chain length is short, * and deletions would otherwise require toombstones. diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index f46cd49bab..1ac56ccbb1 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -842,7 +842,7 @@ typedef LONG slock_t; #define SPIN_DELAY() spin_delay() /* If using Visual C++ on Win64, inline assembly is unavailable. - * Use a _mm_pause instrinsic instead of rep nop. + * Use a _mm_pause intrinsic instead of rep nop. */ #if defined(_WIN64) static __forceinline void diff --git a/src/include/tsearch/dicts/spell.h b/src/include/tsearch/dicts/spell.h index 8cba645540..3032d0b508 100644 --- a/src/include/tsearch/dicts/spell.h +++ b/src/include/tsearch/dicts/spell.h @@ -147,7 +147,7 @@ typedef struct } CMPDAffix; /* - * Type of encoding affix flags in Hunspel dictionaries + * Type of encoding affix flags in Hunspell dictionaries */ typedef enum { diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index a3ae92eb35..d5a463d940 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -2,7 +2,7 @@ /* * The aim is to get a simpler interface to the database routines. - * All the tidieous messing around with tuples is supposed to be hidden + * All the tedious messing around with tuples is supposed to be hidden * by this function. */ /* Author: Linus Tolke diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c index 3b0855f722..7216b432d4 100644 --- a/src/interfaces/ecpg/pgtypeslib/datetime.c +++ b/src/interfaces/ecpg/pgtypeslib/datetime.c @@ -324,7 +324,7 @@ PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf) * * function works as follows: * - first we analyze the parameters - * - if this is a special case with no delimiters, add delimters + * - if this is a special case with no delimiters, add delimiters * - find the tokens. First we look for numerical values. If we have found * less than 3 tokens, we check for the months' names and thereafter for * the abbreviations of the months' names. diff --git a/src/interfaces/ecpg/pgtypeslib/numeric.c b/src/interfaces/ecpg/pgtypeslib/numeric.c index 120794550d..a93d074de2 100644 --- a/src/interfaces/ecpg/pgtypeslib/numeric.c +++ b/src/interfaces/ecpg/pgtypeslib/numeric.c @@ -1368,11 +1368,11 @@ PGTYPESnumeric_cmp(numeric *var1, numeric *var2) { /* use cmp_abs function to calculate the result */ - /* both are positive: normal comparation with cmp_abs */ + /* both are positive: normal comparison with cmp_abs */ if (var1->sign == NUMERIC_POS && var2->sign == NUMERIC_POS) return cmp_abs(var1, var2); - /* both are negative: return the inverse of the normal comparation */ + /* both are negative: return the inverse of the normal comparison */ if (var1->sign == NUMERIC_NEG && var2->sign == NUMERIC_NEG) { /* diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 672f0b45d4..2562366bbe 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -207,7 +207,7 @@ create_questionmarks(char *name, bool array) /* In case we have a struct, we have to print as many "?" as there are attributes in the struct * An array is only allowed together with an element argument - * This is essantially only used for inserts, but using a struct as input parameter is an error anywhere else + * This is essentially only used for inserts, but using a struct as input parameter is an error anywhere else * so we don't have to worry here. */ if (p->type->type == ECPGt_struct || (array && p->type->type == ECPGt_array && p->type->u.element->type == ECPGt_struct)) diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer index 31e765ccd3..1c108795de 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -355,7 +355,7 @@ ECPGExecuteImmediateStmt: EXECUTE IMMEDIATE execstring $$ = $3; }; /* - * variable decalartion outside exec sql declare block + * variable declaration outside exec sql declare block */ ECPGVarDeclaration: single_vt_declaration; @@ -707,7 +707,7 @@ struct_union_type_with_symbol: s_struct_union_symbol free(forward_name); forward_name = NULL; - /* This is essantially a typedef but needs the keyword struct/union as well. + /* This is essentially a typedef but needs the keyword struct/union as well. * So we create the typedef for each struct definition with symbol */ for (ptr = types; ptr != NULL; ptr = ptr->next) { @@ -1275,7 +1275,7 @@ descriptor_item: SQL_CARDINALITY { $$ = ECPGd_cardinality; } ; /* - * set/reset the automatic transaction mode, this needs a differnet handling + * set/reset the automatic transaction mode, this needs a different handling * as the other set commands */ ECPGSetAutocommit: SET SQL_AUTOCOMMIT '=' on_off { $$ = $4; } @@ -1287,7 +1287,7 @@ on_off: ON { $$ = mm_strdup("on"); } ; /* - * set the actual connection, this needs a differnet handling as the other + * set the actual connection, this needs a different handling as the other * set commands */ ECPGSetConnection: SET CONNECTION TO connection_object { $$ = $4; } diff --git a/src/interfaces/ecpg/preproc/parse.pl b/src/interfaces/ecpg/preproc/parse.pl index ea661d3694..8a401304ec 100644 --- a/src/interfaces/ecpg/preproc/parse.pl +++ b/src/interfaces/ecpg/preproc/parse.pl @@ -550,7 +550,7 @@ sub dump_fields if ($len == 1) { - # Straight assignement + # Straight assignment $str = ' $$ = ' . $flds_new[0] . ';'; add_to_buffer('rules', $str); } diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 2845d3b9d2..b47a16e3d0 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -803,7 +803,7 @@ pg_fe_getauthname(PQExpBuffer errorMessage) * be sent in cleartext if it is encrypted on the client side. This is * good because it ensures the cleartext password won't end up in logs, * pg_stat displays, etc. We export the function so that clients won't - * be dependent on low-level details like whether the enceyption is MD5 + * be dependent on low-level details like whether the encryption is MD5 * or something else. * * Arguments are the cleartext password, and the SQL name of the user it diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index c655388864..e9b73a925e 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -309,7 +309,7 @@ typedef struct pg_conn_host char *host; /* host name or address, or socket path */ pg_conn_host_type type; /* type of host */ char *port; /* port number for this host; if not NULL, - * overrrides the PGConn's pgport */ + * overrides the PGConn's pgport */ char *password; /* password for this host, read from the * password file. only set if the PGconn's * pgpass field is NULL. */ @@ -666,7 +666,7 @@ extern void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending, #endif /* - * The SSL implementatation provides these functions (fe-secure-openssl.c) + * The SSL implementation provides these functions (fe-secure-openssl.c) */ extern void pgtls_init_library(bool do_ssl, int do_crypto); extern int pgtls_init(PGconn *conn); diff --git a/src/interfaces/libpq/win32.c b/src/interfaces/libpq/win32.c index d6ecca3859..f99f9a8cdb 100644 --- a/src/interfaces/libpq/win32.c +++ b/src/interfaces/libpq/win32.c @@ -32,7 +32,7 @@ #include "win32.h" -/* Declared here to avoid pulling in all includes, which causes name collissions */ +/* Declared here to avoid pulling in all includes, which causes name collisions */ #ifdef ENABLE_NLS extern char *libpq_gettext(const char *msgid) pg_attribute_format_arg(1); #else diff --git a/src/pl/plperl/ppport.h b/src/pl/plperl/ppport.h index 5ea0c66e98..31d06cb3b0 100644 --- a/src/pl/plperl/ppport.h +++ b/src/pl/plperl/ppport.h @@ -79,7 +79,7 @@ to be installed on your system. If this option is given, a copy of each file will be saved with the given suffix that contains the suggested changes. This does not require any external programs. Note that this does not -automagially add a dot between the original filename and the +automagically add a dot between the original filename and the suffix. If you want the dot, you have to include it in the option argument. @@ -4364,9 +4364,9 @@ DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args) OP * const modname = newSVOP(OP_CONST, 0, name); /* 5.005 has a somewhat hacky force_normal that doesn't croak on - SvREADONLY() if PL_compling is true. Current perls take care in + SvREADONLY() if PL_compiling is true. Current perls take care in ck_require() to correctly turn off SvREADONLY before calling - force_normal_flags(). This seems a better fix than fudging PL_compling + force_normal_flags(). This seems a better fix than fudging PL_compiling */ SvREADONLY_off(((SVOP*)modname)->op_sv); modname->op_private |= OPpCONST_BARE; diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c index d61493fac8..c4806274bc 100644 --- a/src/pl/plpython/plpy_elog.c +++ b/src/pl/plpython/plpy_elog.c @@ -303,7 +303,7 @@ PLy_traceback(PyObject *e, PyObject *v, PyObject *tb, long plain_lineno; /* - * The second frame points at the internal function, but to mimick + * The second frame points at the internal function, but to mimic * Python error reporting we want to say . */ if (*tb_depth == 1) diff --git a/src/pl/plpython/plpy_plpymodule.c b/src/pl/plpython/plpy_plpymodule.c index 0cf2ad29cb..761534406d 100644 --- a/src/pl/plpython/plpy_plpymodule.c +++ b/src/pl/plpython/plpy_plpymodule.c @@ -463,7 +463,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw) if (strcmp(keyword, "message") == 0) { - /* the message should not be overwriten */ + /* the message should not be overwritten */ if (PyTuple_Size(args) != 0) { PLy_exception_set(PyExc_TypeError, "Argument 'message' given by name and position"); diff --git a/src/pl/plpython/plpy_typeio.h b/src/pl/plpython/plpy_typeio.h index 5f5c1ad5c6..e04722c47a 100644 --- a/src/pl/plpython/plpy_typeio.h +++ b/src/pl/plpython/plpy_typeio.h @@ -43,7 +43,7 @@ typedef union PLyTypeInput } PLyTypeInput; /* - * Conversion from Python object to a Postgresql Datum. + * Conversion from Python object to a PostgreSQL Datum. * * The 'inarray' argument to the conversion function is true, if the * converted value was in an array (Python list). It is used to give a @@ -78,7 +78,7 @@ typedef union PLyTypeOutput PLyObToTuple r; } PLyTypeOutput; -/* all we need to move Postgresql data to Python objects, +/* all we need to move PostgreSQL data to Python objects, * and vice versa */ typedef struct PLyTypeInfo diff --git a/src/test/isolation/specs/receipt-report.spec b/src/test/isolation/specs/receipt-report.spec index 1e214960d1..5e1d51d0bd 100644 --- a/src/test/isolation/specs/receipt-report.spec +++ b/src/test/isolation/specs/receipt-report.spec @@ -7,7 +7,7 @@ # be changed and a report of the closed day's receipts subsequently # run which will miss a receipt from the date which has been closed. # -# There are only six permuations which must cause a serialization failure. +# There are only six permutations which must cause a serialization failure. # Failure cases are where s1 overlaps both s2 and s3, but s2 commits before # s3 executes its first SELECT. # diff --git a/src/test/isolation/specs/two-ids.spec b/src/test/isolation/specs/two-ids.spec index d67064068e..277097125a 100644 --- a/src/test/isolation/specs/two-ids.spec +++ b/src/test/isolation/specs/two-ids.spec @@ -2,7 +2,7 @@ # # Small, simple test showing read-only anomalies. # -# There are only four permuations which must cause a serialization failure. +# There are only four permutations which must cause a serialization failure. # Required failure cases are where s2 overlaps both s1 and s3, but s1 # commits before s3 executes its first SELECT. # diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 76b9c2d372..d8e7b61294 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -310,7 +310,7 @@ INSERT INTO tmp3 values (5,50); -- Try (and fail) to add constraint due to invalid source columns ALTER TABLE tmp3 add constraint tmpconstr foreign key(c) references tmp2 match full; ERROR: column "c" referenced in foreign key constraint does not exist --- Try (and fail) to add constraint due to invalide destination columns explicitly given +-- Try (and fail) to add constraint due to invalid destination columns explicitly given ALTER TABLE tmp3 add constraint tmpconstr foreign key(a) references tmp2(b) match full; ERROR: column "b" referenced in foreign key constraint does not exist -- Try (and fail) to add constraint due to invalid data @@ -2842,7 +2842,7 @@ ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists ERROR: could not change table "unlogged2" to logged because it references unlogged table "unlogged1" ALTER TABLE unlogged1 SET LOGGED; --- check relpersistence of an unlogged table after changing to permament +-- check relpersistence of an unlogged table after changing to permanent SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1' UNION ALL SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1' @@ -3029,7 +3029,7 @@ ERROR: cannot alter type of column referenced in partition key expression -- cannot drop NOT NULL on columns in the range partition key ALTER TABLE partitioned ALTER COLUMN a DROP NOT NULL; ERROR: column "a" is in range partition key --- partitioned table cannot partiticipate in regular inheritance +-- partitioned table cannot participate in regular inheritance CREATE TABLE foo ( a int, b int diff --git a/src/test/regress/expected/create_table.out b/src/test/regress/expected/create_table.out index 36266f0a32..fc92cd92dd 100644 --- a/src/test/regress/expected/create_table.out +++ b/src/test/regress/expected/create_table.out @@ -424,7 +424,7 @@ DROP FUNCTION plusone(int); ERROR: cannot drop function plusone(integer) because other objects depend on it DETAIL: table partitioned depends on function plusone(integer) HINT: Use DROP ... CASCADE to drop the dependent objects too. --- partitioned table cannot partiticipate in regular inheritance +-- partitioned table cannot participate in regular inheritance CREATE TABLE partitioned2 ( a int ) PARTITION BY LIST ((a+1)); diff --git a/src/test/regress/expected/indirect_toast.out b/src/test/regress/expected/indirect_toast.out index 4f4bf41973..3e255fbded 100644 --- a/src/test/regress/expected/indirect_toast.out +++ b/src/test/regress/expected/indirect_toast.out @@ -23,7 +23,7 @@ UPDATE toasttest SET cnt = cnt +1 RETURNING substring(toasttest::text, 1, 200); ("one-toasted,one-null",1,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 (4 rows) --- modification without modifying asigned value +-- modification without modifying assigned value UPDATE toasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(toasttest::text, 1, 200); substring ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -61,7 +61,7 @@ SELECT substring(toasttest::text, 1, 200) FROM toasttest; ("one-toasted,one-null",4,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 (4 rows) --- check we didn't screw with main/toast tuple visiblity +-- check we didn't screw with main/toast tuple visibility VACUUM FREEZE toasttest; SELECT substring(toasttest::text, 1, 200) FROM toasttest; substring @@ -95,7 +95,7 @@ UPDATE toasttest SET cnt = cnt +1 RETURNING substring(toasttest::text, 1, 200); ("one-toasted,one-null",5,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 (4 rows) --- modification without modifying asigned value +-- modification without modifying assigned value UPDATE toasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(toasttest::text, 1, 200); substring ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -135,7 +135,7 @@ SELECT substring(toasttest::text, 1, 200) FROM toasttest; ("one-toasted,one-null, via indirect",0,1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 (5 rows) --- check we didn't screw with main/toast tuple visiblity +-- check we didn't screw with main/toast tuple visibility VACUUM FREEZE toasttest; SELECT substring(toasttest::text, 1, 200) FROM toasttest; substring diff --git a/src/test/regress/expected/init_privs.out b/src/test/regress/expected/init_privs.out index 55139d4d37..292b1a1035 100644 --- a/src/test/regress/expected/init_privs.out +++ b/src/test/regress/expected/init_privs.out @@ -1,4 +1,4 @@ --- Test iniital privileges +-- Test initial privileges -- There should always be some initial privileges, set up by initdb SELECT count(*) > 0 FROM pg_init_privs; ?column? diff --git a/src/test/regress/expected/insert_conflict.out b/src/test/regress/expected/insert_conflict.out index 63859c53ac..8d005fddd4 100644 --- a/src/test/regress/expected/insert_conflict.out +++ b/src/test/regress/expected/insert_conflict.out @@ -291,7 +291,7 @@ insert into insertconflicttest values (12, 'Date') on conflict (lower(fruit), ke ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification drop index comp_key_index; -- --- Partial index tests, no inference predicate specificied +-- Partial index tests, no inference predicate specified -- create unique index part_comp_key_index on insertconflicttest(key, fruit) where key < 5; create unique index expr_part_comp_key_index on insertconflicttest(key, lower(fruit)) where key < 5; diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index d9bbae097b..c3bb4fe767 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -4260,7 +4260,7 @@ select * from -- Test hints given on incorrect column references are useful -- select t1.uunique1 from - tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t1" suggestipn + tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t1" suggestion ERROR: column t1.uunique1 does not exist LINE 1: select t1.uunique1 from ^ diff --git a/src/test/regress/expected/matview.out b/src/test/regress/expected/matview.out index 4ae44607a4..d1f35c5833 100644 --- a/src/test/regress/expected/matview.out +++ b/src/test/regress/expected/matview.out @@ -292,7 +292,7 @@ SELECT * FROM mvtest_tvvm; -- test diemv when the mv does not exist DROP MATERIALIZED VIEW IF EXISTS no_such_mv; NOTICE: materialized view "no_such_mv" does not exist, skipping --- make sure invalid comination of options is prohibited +-- make sure invalid combination of options is prohibited REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_tvmm WITH NO DATA; ERROR: CONCURRENTLY and WITH NO DATA options cannot be used together -- no tuple locks on materialized views diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out index 79513e4598..04848c10a2 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -1423,7 +1423,7 @@ select * from WSlot order by slotname; -- -- Install the central phone system and create the phone numbers. --- They are weired on insert to the patchfields. Again the +-- They are wired on insert to the patchfields. Again the -- triggers automatically tell the PSlots to update their -- backlink field. -- diff --git a/src/test/regress/expected/replica_identity.out b/src/test/regress/expected/replica_identity.out index 1a04ec5561..fa63235fc9 100644 --- a/src/test/regress/expected/replica_identity.out +++ b/src/test/regress/expected/replica_identity.out @@ -98,7 +98,7 @@ Indexes: -- succeed, oid unique index ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_oid_idx; --- succeed, nondeferrable unique constraint over nonullable cols +-- succeed, nondeferrable unique constraint over nonnullable cols ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_unique_nondefer; -- succeed unique index over nonnullable cols ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_keyab_key; diff --git a/src/test/regress/expected/rolenames.out b/src/test/regress/expected/rolenames.out index b8bf0cf877..fd058e4f7d 100644 --- a/src/test/regress/expected/rolenames.out +++ b/src/test/regress/expected/rolenames.out @@ -440,7 +440,7 @@ LINE 1: ALTER USER NONE SET application_name to 'BOMB'; ^ ALTER USER nonexistent SET application_name to 'BOMB'; -- error ERROR: role "nonexistent" does not exist --- CREAETE SCHEMA +-- CREATE SCHEMA set client_min_messages to error; CREATE SCHEMA newschema1 AUTHORIZATION CURRENT_USER; CREATE SCHEMA newschema2 AUTHORIZATION "current_user"; diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index de5ae00970..60731a99b7 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -938,7 +938,7 @@ CREATE TABLE shoe_data ( shoename char(10), -- primary key sh_avail integer, -- available # of pairs slcolor char(10), -- preferred shoelace color - slminlen float, -- miminum shoelace length + slminlen float, -- minimum shoelace length slmaxlen float, -- maximum shoelace length slunit char(8) -- length unit ); diff --git a/src/test/regress/expected/tsdicts.out b/src/test/regress/expected/tsdicts.out index 8ed64d3c68..493a25587c 100644 --- a/src/test/regress/expected/tsdicts.out +++ b/src/test/regress/expected/tsdicts.out @@ -383,7 +383,7 @@ SELECT ts_lexize('hunspell_num', 'footballyklubber'); {foot,ball,klubber} (1 row) --- Synonim dictionary +-- Synonym dictionary CREATE TEXT SEARCH DICTIONARY synonym ( Template=synonym, Synonyms=synonym_sample diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index 4611cbb731..1f551ec53c 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -255,7 +255,7 @@ INSERT INTO tmp3 values (5,50); -- Try (and fail) to add constraint due to invalid source columns ALTER TABLE tmp3 add constraint tmpconstr foreign key(c) references tmp2 match full; --- Try (and fail) to add constraint due to invalide destination columns explicitly given +-- Try (and fail) to add constraint due to invalid destination columns explicitly given ALTER TABLE tmp3 add constraint tmpconstr foreign key(a) references tmp2(b) match full; -- Try (and fail) to add constraint due to invalid data @@ -1829,7 +1829,7 @@ CREATE UNLOGGED TABLE unlogged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unl ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists ALTER TABLE unlogged1 SET LOGGED; --- check relpersistence of an unlogged table after changing to permament +-- check relpersistence of an unlogged table after changing to permanent SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1' UNION ALL SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1' @@ -1917,7 +1917,7 @@ ALTER TABLE partitioned ALTER COLUMN b TYPE char(5); -- cannot drop NOT NULL on columns in the range partition key ALTER TABLE partitioned ALTER COLUMN a DROP NOT NULL; --- partitioned table cannot partiticipate in regular inheritance +-- partitioned table cannot participate in regular inheritance CREATE TABLE foo ( a int, b int diff --git a/src/test/regress/sql/create_table.sql b/src/test/regress/sql/create_table.sql index 6314aa403f..5f25c436ee 100644 --- a/src/test/regress/sql/create_table.sql +++ b/src/test/regress/sql/create_table.sql @@ -418,7 +418,7 @@ SELECT attname, attnotnull FROM pg_attribute -- prevent a function referenced in partition key from being dropped DROP FUNCTION plusone(int); --- partitioned table cannot partiticipate in regular inheritance +-- partitioned table cannot participate in regular inheritance CREATE TABLE partitioned2 ( a int ) PARTITION BY LIST ((a+1)); diff --git a/src/test/regress/sql/indirect_toast.sql b/src/test/regress/sql/indirect_toast.sql index d502480ad3..18b6cc3a95 100644 --- a/src/test/regress/sql/indirect_toast.sql +++ b/src/test/regress/sql/indirect_toast.sql @@ -11,7 +11,7 @@ SELECT descr, substring(make_tuple_indirect(toasttest)::text, 1, 200) FROM toast -- modification without changing varlenas UPDATE toasttest SET cnt = cnt +1 RETURNING substring(toasttest::text, 1, 200); --- modification without modifying asigned value +-- modification without modifying assigned value UPDATE toasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(toasttest::text, 1, 200); -- modification modifying, but effectively not changing @@ -20,7 +20,7 @@ UPDATE toasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(toasttest::te UPDATE toasttest SET cnt = cnt +1, f1 = '-'||f1||'-' RETURNING substring(toasttest::text, 1, 200); SELECT substring(toasttest::text, 1, 200) FROM toasttest; --- check we didn't screw with main/toast tuple visiblity +-- check we didn't screw with main/toast tuple visibility VACUUM FREEZE toasttest; SELECT substring(toasttest::text, 1, 200) FROM toasttest; @@ -42,7 +42,7 @@ CREATE TRIGGER toasttest_update_indirect -- modification without changing varlenas UPDATE toasttest SET cnt = cnt +1 RETURNING substring(toasttest::text, 1, 200); --- modification without modifying asigned value +-- modification without modifying assigned value UPDATE toasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(toasttest::text, 1, 200); -- modification modifying, but effectively not changing @@ -53,7 +53,7 @@ UPDATE toasttest SET cnt = cnt +1, f1 = '-'||f1||'-' RETURNING substring(toastte INSERT INTO toasttest(descr, f1, f2) VALUES('one-toasted,one-null, via indirect', repeat('1234567890',30000), NULL); SELECT substring(toasttest::text, 1, 200) FROM toasttest; --- check we didn't screw with main/toast tuple visiblity +-- check we didn't screw with main/toast tuple visibility VACUUM FREEZE toasttest; SELECT substring(toasttest::text, 1, 200) FROM toasttest; diff --git a/src/test/regress/sql/init_privs.sql b/src/test/regress/sql/init_privs.sql index 9b4c70246e..4a31af2798 100644 --- a/src/test/regress/sql/init_privs.sql +++ b/src/test/regress/sql/init_privs.sql @@ -1,4 +1,4 @@ --- Test iniital privileges +-- Test initial privileges -- There should always be some initial privileges, set up by initdb SELECT count(*) > 0 FROM pg_init_privs; diff --git a/src/test/regress/sql/insert_conflict.sql b/src/test/regress/sql/insert_conflict.sql index 116cf763f9..df3a9b59b5 100644 --- a/src/test/regress/sql/insert_conflict.sql +++ b/src/test/regress/sql/insert_conflict.sql @@ -138,7 +138,7 @@ insert into insertconflicttest values (12, 'Date') on conflict (lower(fruit), ke drop index comp_key_index; -- --- Partial index tests, no inference predicate specificied +-- Partial index tests, no inference predicate specified -- create unique index part_comp_key_index on insertconflicttest(key, fruit) where key < 5; create unique index expr_part_comp_key_index on insertconflicttest(key, lower(fruit)) where key < 5; diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 97bccec721..bf18a8f6c4 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -1456,7 +1456,7 @@ select * from -- select t1.uunique1 from - tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t1" suggestipn + tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t1" suggestion select t2.uunique1 from tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t2" suggestion select uunique1 from diff --git a/src/test/regress/sql/matview.sql b/src/test/regress/sql/matview.sql index 1164b4cea2..e0f4a1319f 100644 --- a/src/test/regress/sql/matview.sql +++ b/src/test/regress/sql/matview.sql @@ -92,7 +92,7 @@ SELECT * FROM mvtest_tvvm; -- test diemv when the mv does not exist DROP MATERIALIZED VIEW IF EXISTS no_such_mv; --- make sure invalid comination of options is prohibited +-- make sure invalid combination of options is prohibited REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_tvmm WITH NO DATA; -- no tuple locks on materialized views diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql index 877d3ad08e..31dcbdffdd 100644 --- a/src/test/regress/sql/plpgsql.sql +++ b/src/test/regress/sql/plpgsql.sql @@ -1350,7 +1350,7 @@ select * from WSlot order by slotname; -- -- Install the central phone system and create the phone numbers. --- They are weired on insert to the patchfields. Again the +-- They are wired on insert to the patchfields. Again the -- triggers automatically tell the PSlots to update their -- backlink field. -- diff --git a/src/test/regress/sql/replica_identity.sql b/src/test/regress/sql/replica_identity.sql index 68824a3aa7..3d2171c733 100644 --- a/src/test/regress/sql/replica_identity.sql +++ b/src/test/regress/sql/replica_identity.sql @@ -56,7 +56,7 @@ SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; -- succeed, oid unique index ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_oid_idx; --- succeed, nondeferrable unique constraint over nonullable cols +-- succeed, nondeferrable unique constraint over nonnullable cols ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_unique_nondefer; -- succeed unique index over nonnullable cols diff --git a/src/test/regress/sql/rolenames.sql b/src/test/regress/sql/rolenames.sql index 451d9d338d..4c5706bbaa 100644 --- a/src/test/regress/sql/rolenames.sql +++ b/src/test/regress/sql/rolenames.sql @@ -176,7 +176,7 @@ ALTER USER PUBLIC SET application_name to 'BOMB'; -- error ALTER USER NONE SET application_name to 'BOMB'; -- error ALTER USER nonexistent SET application_name to 'BOMB'; -- error --- CREAETE SCHEMA +-- CREATE SCHEMA set client_min_messages to error; CREATE SCHEMA newschema1 AUTHORIZATION CURRENT_USER; CREATE SCHEMA newschema2 AUTHORIZATION "current_user"; diff --git a/src/test/regress/sql/rules.sql b/src/test/regress/sql/rules.sql index 835945f4b7..90dc9ceaf4 100644 --- a/src/test/regress/sql/rules.sql +++ b/src/test/regress/sql/rules.sql @@ -522,7 +522,7 @@ CREATE TABLE shoe_data ( shoename char(10), -- primary key sh_avail integer, -- available # of pairs slcolor char(10), -- preferred shoelace color - slminlen float, -- miminum shoelace length + slminlen float, -- minimum shoelace length slmaxlen float, -- maximum shoelace length slunit char(8) -- length unit ); diff --git a/src/test/regress/sql/tsdicts.sql b/src/test/regress/sql/tsdicts.sql index 4d0419e35a..ed2cbe1fec 100644 --- a/src/test/regress/sql/tsdicts.sql +++ b/src/test/regress/sql/tsdicts.sql @@ -96,7 +96,7 @@ SELECT ts_lexize('hunspell_num', 'footballklubber'); SELECT ts_lexize('hunspell_num', 'ballyklubber'); SELECT ts_lexize('hunspell_num', 'footballyklubber'); --- Synonim dictionary +-- Synonym dictionary CREATE TEXT SEARCH DICTIONARY synonym ( Template=synonym, Synonyms=synonym_sample diff --git a/src/test/ssl/ServerSetup.pm b/src/test/ssl/ServerSetup.pm index 20eaf76bff..9441249b3a 100644 --- a/src/test/ssl/ServerSetup.pm +++ b/src/test/ssl/ServerSetup.pm @@ -7,7 +7,7 @@ # - ssl/root+client_ca.crt as the CA root for validating client certs. # - reject non-SSL connections # - a database called trustdb that lets anyone in -# - another database called certdb that uses certificate authentiction, ie. +# - another database called certdb that uses certificate authentication, ie. # the client must present a valid certificate signed by the client CA # - two users, called ssltestuser and anotheruser. # -- cgit v1.2.3 From 3a0d473192b2045cbaf997df8437e7762d34f3ba Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Sun, 12 Mar 2017 19:35:34 -0400 Subject: Use wrappers of PG_DETOAST_DATUM_PACKED() more. This makes almost all core code follow the policy introduced in the previous commit. Specific decisions: - Text search support functions with char* and length arguments, such as prsstart and lexize, may receive unaligned strings. I doubt maintainers of non-core text search code will notice. - Use plain VARDATA() on values detoasted or synthesized earlier in the same function. Use VARDATA_ANY() on varlenas sourced outside the function, even if they happen to always have four-byte headers. As an exception, retain the universal practice of using VARDATA() on return values of SendFunctionCall(). - Retain PG_GETARG_BYTEA_P() in pageinspect. (Page images are too large for a one-byte header, so this misses no optimization.) Sites that do not call get_page_from_raw() typically need the four-byte alignment. - For now, do not change btree_gist. Its use of four-byte headers in memory is partly entangled with storage of 4-byte headers inside GBT_VARKEY, on disk. - For now, do not change gtrgm_consistent() or gtrgm_distance(). They incorporate the varlena header into a cache, and there are multiple credible implementation strategies to consider. --- contrib/adminpack/adminpack.c | 16 +- contrib/dblink/dblink.c | 10 +- contrib/fuzzystrmatch/dmetaphone.c | 4 +- contrib/fuzzystrmatch/fuzzystrmatch.c | 6 +- contrib/intarray/_int_op.c | 6 +- contrib/pageinspect/btreefuncs.c | 6 +- contrib/pageinspect/rawpage.c | 10 +- contrib/pg_prewarm/pg_prewarm.c | 4 +- contrib/pg_trgm/trgm_gin.c | 15 +- contrib/pg_trgm/trgm_gist.c | 17 +- contrib/pg_trgm/trgm_op.c | 12 +- contrib/pgcrypto/pgcrypto.c | 94 +++++------ contrib/pgcrypto/pgp-pgsql.c | 100 ++++++------ contrib/pgrowlocks/pgrowlocks.c | 2 +- contrib/pgstattuple/pgstatindex.c | 8 +- contrib/pgstattuple/pgstattuple.c | 4 +- contrib/sepgsql/label.c | 4 +- contrib/spi/autoinc.c | 2 +- contrib/sslinfo/sslinfo.c | 4 +- contrib/unaccent/unaccent.c | 6 +- contrib/uuid-ossp/uuid-ossp.c | 8 +- contrib/xml2/xpath.c | 42 ++--- contrib/xml2/xslt_proc.c | 14 +- src/backend/access/spgist/spgtextproc.c | 3 +- src/backend/access/transam/xlogfuncs.c | 4 +- src/backend/commands/extension.c | 2 +- src/backend/commands/sequence.c | 2 +- src/backend/commands/trigger.c | 8 +- src/backend/commands/tsearchcmds.c | 6 +- src/backend/executor/execQual.c | 6 +- src/backend/libpq/be-fsstubs.c | 6 +- src/backend/replication/logical/origin.c | 2 +- src/backend/tsearch/dict.c | 10 +- src/backend/tsearch/to_tsany.c | 22 +-- src/backend/tsearch/wparser.c | 19 +-- src/backend/utils/adt/acl.c | 260 +++++++++++++++---------------- src/backend/utils/adt/char.c | 6 +- src/backend/utils/adt/dbsize.c | 2 +- src/backend/utils/adt/encode.c | 16 +- src/backend/utils/adt/formatting.c | 40 ++--- src/backend/utils/adt/genfile.c | 8 +- src/backend/utils/adt/json.c | 8 +- src/backend/utils/adt/jsonb.c | 2 +- src/backend/utils/adt/jsonfuncs.c | 24 +-- src/backend/utils/adt/like.c | 24 +-- src/backend/utils/adt/numeric.c | 44 +++--- src/backend/utils/adt/quote.c | 6 +- src/backend/utils/adt/rangetypes.c | 2 +- src/backend/utils/adt/regproc.c | 2 +- src/backend/utils/adt/ruleutils.c | 12 +- src/backend/utils/adt/selfuncs.c | 18 +-- src/backend/utils/adt/tid.c | 2 +- src/backend/utils/adt/tsquery_rewrite.c | 2 +- src/backend/utils/adt/tsvector_op.c | 18 +-- src/backend/utils/adt/varlena.c | 24 +-- src/backend/utils/adt/xml.c | 28 ++-- src/backend/utils/misc/rls.c | 2 +- src/pl/plperl/Util.xs | 10 +- src/pl/plpython/plpy_typeio.c | 6 +- 59 files changed, 521 insertions(+), 529 deletions(-) (limited to 'contrib/xml2/xpath.c') diff --git a/contrib/adminpack/adminpack.c b/contrib/adminpack/adminpack.c index a63ff36f05..10338f951f 100644 --- a/contrib/adminpack/adminpack.c +++ b/contrib/adminpack/adminpack.c @@ -124,8 +124,8 @@ pg_file_write(PG_FUNCTION_ARGS) requireSuperuser(); - filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false); - data = PG_GETARG_TEXT_P(1); + filename = convert_and_check_filename(PG_GETARG_TEXT_PP(0), false); + data = PG_GETARG_TEXT_PP(1); if (!PG_GETARG_BOOL(2)) { @@ -147,8 +147,8 @@ pg_file_write(PG_FUNCTION_ARGS) errmsg("could not open file \"%s\" for writing: %m", filename))); - count = fwrite(VARDATA(data), 1, VARSIZE(data) - VARHDRSZ, f); - if (count != VARSIZE(data) - VARHDRSZ || FreeFile(f)) + count = fwrite(VARDATA_ANY(data), 1, VARSIZE_ANY_EXHDR(data), f); + if (count != VARSIZE_ANY_EXHDR(data) || FreeFile(f)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not write file \"%s\": %m", filename))); @@ -170,12 +170,12 @@ pg_file_rename(PG_FUNCTION_ARGS) if (PG_ARGISNULL(0) || PG_ARGISNULL(1)) PG_RETURN_NULL(); - fn1 = convert_and_check_filename(PG_GETARG_TEXT_P(0), false); - fn2 = convert_and_check_filename(PG_GETARG_TEXT_P(1), false); + fn1 = convert_and_check_filename(PG_GETARG_TEXT_PP(0), false); + fn2 = convert_and_check_filename(PG_GETARG_TEXT_PP(1), false); if (PG_ARGISNULL(2)) fn3 = 0; else - fn3 = convert_and_check_filename(PG_GETARG_TEXT_P(2), false); + fn3 = convert_and_check_filename(PG_GETARG_TEXT_PP(2), false); if (access(fn1, W_OK) < 0) { @@ -254,7 +254,7 @@ pg_file_unlink(PG_FUNCTION_ARGS) requireSuperuser(); - filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false); + filename = convert_and_check_filename(PG_GETARG_TEXT_PP(0), false); if (access(filename, W_OK) < 0) { diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index eba6f274dc..1266a77530 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -1502,7 +1502,7 @@ dblink_get_pkey(PG_FUNCTION_ARGS) oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); /* open target relation */ - rel = get_rel_from_relname(PG_GETARG_TEXT_P(0), AccessShareLock, ACL_SELECT); + rel = get_rel_from_relname(PG_GETARG_TEXT_PP(0), AccessShareLock, ACL_SELECT); /* get the array of attnums */ results = get_pkey_attnames(rel, &numatts); @@ -1603,7 +1603,7 @@ PG_FUNCTION_INFO_V1(dblink_build_sql_insert); Datum dblink_build_sql_insert(PG_FUNCTION_ARGS) { - text *relname_text = PG_GETARG_TEXT_P(0); + text *relname_text = PG_GETARG_TEXT_PP(0); int2vector *pkattnums_arg = (int2vector *) PG_GETARG_POINTER(1); int32 pknumatts_arg = PG_GETARG_INT32(2); ArrayType *src_pkattvals_arry = PG_GETARG_ARRAYTYPE_P(3); @@ -1694,7 +1694,7 @@ PG_FUNCTION_INFO_V1(dblink_build_sql_delete); Datum dblink_build_sql_delete(PG_FUNCTION_ARGS) { - text *relname_text = PG_GETARG_TEXT_P(0); + text *relname_text = PG_GETARG_TEXT_PP(0); int2vector *pkattnums_arg = (int2vector *) PG_GETARG_POINTER(1); int32 pknumatts_arg = PG_GETARG_INT32(2); ArrayType *tgt_pkattvals_arry = PG_GETARG_ARRAYTYPE_P(3); @@ -1771,7 +1771,7 @@ PG_FUNCTION_INFO_V1(dblink_build_sql_update); Datum dblink_build_sql_update(PG_FUNCTION_ARGS) { - text *relname_text = PG_GETARG_TEXT_P(0); + text *relname_text = PG_GETARG_TEXT_PP(0); int2vector *pkattnums_arg = (int2vector *) PG_GETARG_POINTER(1); int32 pknumatts_arg = PG_GETARG_INT32(2); ArrayType *src_pkattvals_arry = PG_GETARG_ARRAYTYPE_P(3); @@ -2338,7 +2338,7 @@ quote_ident_cstr(char *rawstr) char *result; rawstr_text = cstring_to_text(rawstr); - result_text = DatumGetTextP(DirectFunctionCall1(quote_ident, + result_text = DatumGetTextPP(DirectFunctionCall1(quote_ident, PointerGetDatum(rawstr_text))); result = text_to_cstring(result_text); diff --git a/contrib/fuzzystrmatch/dmetaphone.c b/contrib/fuzzystrmatch/dmetaphone.c index f210869acb..4e89983afd 100644 --- a/contrib/fuzzystrmatch/dmetaphone.c +++ b/contrib/fuzzystrmatch/dmetaphone.c @@ -139,7 +139,7 @@ dmetaphone(PG_FUNCTION_ARGS) if (PG_ARGISNULL(0)) PG_RETURN_NULL(); #endif - arg = PG_GETARG_TEXT_P(0); + arg = PG_GETARG_TEXT_PP(0); aptr = text_to_cstring(arg); DoubleMetaphone(aptr, codes); @@ -168,7 +168,7 @@ dmetaphone_alt(PG_FUNCTION_ARGS) if (PG_ARGISNULL(0)) PG_RETURN_NULL(); #endif - arg = PG_GETARG_TEXT_P(0); + arg = PG_GETARG_TEXT_PP(0); aptr = text_to_cstring(arg); DoubleMetaphone(aptr, codes); diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c index bd36fc57dc..f1bb7bca73 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.c +++ b/contrib/fuzzystrmatch/fuzzystrmatch.c @@ -736,7 +736,7 @@ soundex(PG_FUNCTION_ARGS) char outstr[SOUNDEX_LEN + 1]; char *arg; - arg = text_to_cstring(PG_GETARG_TEXT_P(0)); + arg = text_to_cstring(PG_GETARG_TEXT_PP(0)); _soundex(arg, outstr); @@ -802,8 +802,8 @@ difference(PG_FUNCTION_ARGS) int i, result; - _soundex(text_to_cstring(PG_GETARG_TEXT_P(0)), sndx1); - _soundex(text_to_cstring(PG_GETARG_TEXT_P(1)), sndx2); + _soundex(text_to_cstring(PG_GETARG_TEXT_PP(0)), sndx1); + _soundex(text_to_cstring(PG_GETARG_TEXT_PP(1)), sndx2); result = 0; for (i = 0; i < SOUNDEX_LEN; i++) diff --git a/contrib/intarray/_int_op.c b/contrib/intarray/_int_op.c index 537174175b..c30d3c8269 100644 --- a/contrib/intarray/_int_op.c +++ b/contrib/intarray/_int_op.c @@ -200,9 +200,9 @@ Datum sort(PG_FUNCTION_ARGS) { ArrayType *a = PG_GETARG_ARRAYTYPE_P_COPY(0); - text *dirstr = (fcinfo->nargs == 2) ? PG_GETARG_TEXT_P(1) : NULL; - int32 dc = (dirstr) ? VARSIZE(dirstr) - VARHDRSZ : 0; - char *d = (dirstr) ? VARDATA(dirstr) : NULL; + text *dirstr = (fcinfo->nargs == 2) ? PG_GETARG_TEXT_PP(1) : NULL; + int32 dc = (dirstr) ? VARSIZE_ANY_EXHDR(dirstr) : 0; + char *d = (dirstr) ? VARDATA_ANY(dirstr) : NULL; int dir = -1; CHECKARRVALID(a); diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c index d50ec3a68d..6f35e288fd 100644 --- a/contrib/pageinspect/btreefuncs.c +++ b/contrib/pageinspect/btreefuncs.c @@ -159,7 +159,7 @@ GetBTPageStatistics(BlockNumber blkno, Buffer buffer, BTPageStat *stat) Datum bt_page_stats(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); uint32 blkno = PG_GETARG_UINT32(1); Buffer buffer; Relation rel; @@ -256,7 +256,7 @@ struct user_args Datum bt_page_items(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); uint32 blkno = PG_GETARG_UINT32(1); Datum result; char *values[6]; @@ -408,7 +408,7 @@ bt_page_items(PG_FUNCTION_ARGS) Datum bt_metap(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); Datum result; Relation rel; RangeVar *relrv; diff --git a/contrib/pageinspect/rawpage.c b/contrib/pageinspect/rawpage.c index 1ccc3ff320..a5def91751 100644 --- a/contrib/pageinspect/rawpage.c +++ b/contrib/pageinspect/rawpage.c @@ -45,7 +45,7 @@ PG_FUNCTION_INFO_V1(get_raw_page); Datum get_raw_page(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); uint32 blkno = PG_GETARG_UINT32(1); bytea *raw_page; @@ -74,8 +74,8 @@ PG_FUNCTION_INFO_V1(get_raw_page_fork); Datum get_raw_page_fork(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); - text *forkname = PG_GETARG_TEXT_P(1); + text *relname = PG_GETARG_TEXT_PP(0); + text *forkname = PG_GETARG_TEXT_PP(1); uint32 blkno = PG_GETARG_UINT32(2); bytea *raw_page; ForkNumber forknum; @@ -184,7 +184,7 @@ get_page_from_raw(bytea *raw_page) Page page; int raw_page_size; - raw_page_size = VARSIZE(raw_page) - VARHDRSZ; + raw_page_size = VARSIZE_ANY_EXHDR(raw_page); if (raw_page_size != BLCKSZ) ereport(ERROR, @@ -195,7 +195,7 @@ get_page_from_raw(bytea *raw_page) page = palloc(raw_page_size); - memcpy(page, VARDATA(raw_page), raw_page_size); + memcpy(page, VARDATA_ANY(raw_page), raw_page_size); return page; } diff --git a/contrib/pg_prewarm/pg_prewarm.c b/contrib/pg_prewarm/pg_prewarm.c index 52ea004e7f..78d71ab078 100644 --- a/contrib/pg_prewarm/pg_prewarm.c +++ b/contrib/pg_prewarm/pg_prewarm.c @@ -79,7 +79,7 @@ pg_prewarm(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errmsg("prewarm type cannot be null")))); - type = PG_GETARG_TEXT_P(1); + type = PG_GETARG_TEXT_PP(1); ttype = text_to_cstring(type); if (strcmp(ttype, "prefetch") == 0) ptype = PREWARM_PREFETCH; @@ -99,7 +99,7 @@ pg_prewarm(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errmsg("relation fork cannot be null")))); - forkName = PG_GETARG_TEXT_P(2); + forkName = PG_GETARG_TEXT_PP(2); forkString = text_to_cstring(forkName); forkNumber = forkname_to_number(forkString); diff --git a/contrib/pg_trgm/trgm_gin.c b/contrib/pg_trgm/trgm_gin.c index ead33ef544..e4b3daea44 100644 --- a/contrib/pg_trgm/trgm_gin.c +++ b/contrib/pg_trgm/trgm_gin.c @@ -35,7 +35,7 @@ gin_extract_trgm(PG_FUNCTION_ARGS) Datum gin_extract_value_trgm(PG_FUNCTION_ARGS) { - text *val = (text *) PG_GETARG_TEXT_P(0); + text *val = (text *) PG_GETARG_TEXT_PP(0); int32 *nentries = (int32 *) PG_GETARG_POINTER(1); Datum *entries = NULL; TRGM *trg; @@ -43,7 +43,7 @@ gin_extract_value_trgm(PG_FUNCTION_ARGS) *nentries = 0; - trg = generate_trgm(VARDATA(val), VARSIZE(val) - VARHDRSZ); + trg = generate_trgm(VARDATA_ANY(val), VARSIZE_ANY_EXHDR(val)); trglen = ARRNELEM(trg); if (trglen > 0) @@ -70,7 +70,7 @@ gin_extract_value_trgm(PG_FUNCTION_ARGS) Datum gin_extract_query_trgm(PG_FUNCTION_ARGS) { - text *val = (text *) PG_GETARG_TEXT_P(0); + text *val = (text *) PG_GETARG_TEXT_PP(0); int32 *nentries = (int32 *) PG_GETARG_POINTER(1); StrategyNumber strategy = PG_GETARG_UINT16(2); @@ -90,7 +90,7 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS) { case SimilarityStrategyNumber: case WordSimilarityStrategyNumber: - trg = generate_trgm(VARDATA(val), VARSIZE(val) - VARHDRSZ); + trg = generate_trgm(VARDATA_ANY(val), VARSIZE_ANY_EXHDR(val)); break; case ILikeStrategyNumber: #ifndef IGNORECASE @@ -103,7 +103,8 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS) * For wildcard search we extract all the trigrams that every * potentially-matching string must include. */ - trg = generate_wildcard_trgm(VARDATA(val), VARSIZE(val) - VARHDRSZ); + trg = generate_wildcard_trgm(VARDATA_ANY(val), + VARSIZE_ANY_EXHDR(val)); break; case RegExpICaseStrategyNumber: #ifndef IGNORECASE @@ -170,7 +171,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS) bool *check = (bool *) PG_GETARG_POINTER(0); StrategyNumber strategy = PG_GETARG_UINT16(1); - /* text *query = PG_GETARG_TEXT_P(2); */ + /* text *query = PG_GETARG_TEXT_PP(2); */ int32 nkeys = PG_GETARG_INT32(3); Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); bool *recheck = (bool *) PG_GETARG_POINTER(5); @@ -268,7 +269,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS) GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0); StrategyNumber strategy = PG_GETARG_UINT16(1); - /* text *query = PG_GETARG_TEXT_P(2); */ + /* text *query = PG_GETARG_TEXT_PP(2); */ int32 nkeys = PG_GETARG_INT32(3); Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); GinTernaryValue res = GIN_MAYBE; diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c index f52867df32..ed02af875c 100644 --- a/contrib/pg_trgm/trgm_gist.c +++ b/contrib/pg_trgm/trgm_gist.c @@ -100,9 +100,9 @@ gtrgm_compress(PG_FUNCTION_ARGS) if (entry->leafkey) { /* trgm */ TRGM *res; - text *val = DatumGetTextP(entry->key); + text *val = DatumGetTextPP(entry->key); - res = generate_trgm(VARDATA(val), VARSIZE(val) - VARHDRSZ); + res = generate_trgm(VARDATA_ANY(val), VARSIZE_ANY_EXHDR(val)); retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, @@ -142,7 +142,7 @@ gtrgm_decompress(PG_FUNCTION_ARGS) GISTENTRY *retval; text *key; - key = DatumGetTextP(entry->key); + key = DatumGetTextPP(entry->key); if (key != (text *) DatumGetPointer(entry->key)) { @@ -200,11 +200,12 @@ gtrgm_consistent(PG_FUNCTION_ARGS) * depends on strategy. * * The cached structure is a single palloc chunk containing the - * gtrgm_consistent_cache header, then the input query (starting at a - * MAXALIGN boundary), then the TRGM value (also starting at a MAXALIGN - * boundary). However we don't try to include the regex graph (if any) in - * that struct. (XXX currently, this approach can leak regex graphs - * across index rescans. Not clear if that's worth fixing.) + * gtrgm_consistent_cache header, then the input query (4-byte length + * word, uncompressed, starting at a MAXALIGN boundary), then the TRGM + * value (also starting at a MAXALIGN boundary). However we don't try to + * include the regex graph (if any) in that struct. (XXX currently, this + * approach can leak regex graphs across index rescans. Not clear if + * that's worth fixing.) */ cache = (gtrgm_consistent_cache *) fcinfo->flinfo->fn_extra; if (cache == NULL || diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c index 368e7c8941..e9a713113e 100644 --- a/contrib/pg_trgm/trgm_op.c +++ b/contrib/pg_trgm/trgm_op.c @@ -878,14 +878,14 @@ trgm2int(trgm *ptr) Datum show_trgm(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(0); + text *in = PG_GETARG_TEXT_PP(0); TRGM *trg; Datum *d; ArrayType *a; trgm *ptr; int i; - trg = generate_trgm(VARDATA(in), VARSIZE(in) - VARHDRSZ); + trg = generate_trgm(VARDATA_ANY(in), VARSIZE_ANY_EXHDR(in)); d = (Datum *) palloc(sizeof(Datum) * (1 + ARRNELEM(trg))); for (i = 0, ptr = GETARR(trg); i < ARRNELEM(trg); i++, ptr++) @@ -1053,14 +1053,14 @@ trgm_presence_map(TRGM *query, TRGM *key) Datum similarity(PG_FUNCTION_ARGS) { - text *in1 = PG_GETARG_TEXT_P(0); - text *in2 = PG_GETARG_TEXT_P(1); + text *in1 = PG_GETARG_TEXT_PP(0); + text *in2 = PG_GETARG_TEXT_PP(1); TRGM *trg1, *trg2; float4 res; - trg1 = generate_trgm(VARDATA(in1), VARSIZE(in1) - VARHDRSZ); - trg2 = generate_trgm(VARDATA(in2), VARSIZE(in2) - VARHDRSZ); + trg1 = generate_trgm(VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1)); + trg2 = generate_trgm(VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2)); res = cnt_sml(trg1, trg2, false); diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c index d815de3073..ccfdc20ed7 100644 --- a/contrib/pgcrypto/pgcrypto.c +++ b/contrib/pgcrypto/pgcrypto.c @@ -62,7 +62,7 @@ pg_digest(PG_FUNCTION_ARGS) PX_MD *md; bytea *res; - name = PG_GETARG_TEXT_P(1); + name = PG_GETARG_TEXT_PP(1); /* will give error if fails */ md = find_provider(name, (PFN) px_find_digest, "Digest", 0); @@ -72,10 +72,10 @@ pg_digest(PG_FUNCTION_ARGS) res = (text *) palloc(hlen + VARHDRSZ); SET_VARSIZE(res, hlen + VARHDRSZ); - arg = PG_GETARG_BYTEA_P(0); - len = VARSIZE(arg) - VARHDRSZ; + arg = PG_GETARG_BYTEA_PP(0); + len = VARSIZE_ANY_EXHDR(arg); - px_md_update(md, (uint8 *) VARDATA(arg), len); + px_md_update(md, (uint8 *) VARDATA_ANY(arg), len); px_md_finish(md, (uint8 *) VARDATA(res)); px_md_free(md); @@ -100,7 +100,7 @@ pg_hmac(PG_FUNCTION_ARGS) PX_HMAC *h; bytea *res; - name = PG_GETARG_TEXT_P(2); + name = PG_GETARG_TEXT_PP(2); /* will give error if fails */ h = find_provider(name, (PFN) px_find_hmac, "HMAC", 0); @@ -110,13 +110,13 @@ pg_hmac(PG_FUNCTION_ARGS) res = (text *) palloc(hlen + VARHDRSZ); SET_VARSIZE(res, hlen + VARHDRSZ); - arg = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); - len = VARSIZE(arg) - VARHDRSZ; - klen = VARSIZE(key) - VARHDRSZ; + arg = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); + len = VARSIZE_ANY_EXHDR(arg); + klen = VARSIZE_ANY_EXHDR(key); - px_hmac_init(h, (uint8 *) VARDATA(key), klen); - px_hmac_update(h, (uint8 *) VARDATA(arg), len); + px_hmac_init(h, (uint8 *) VARDATA_ANY(key), klen); + px_hmac_update(h, (uint8 *) VARDATA_ANY(arg), len); px_hmac_finish(h, (uint8 *) VARDATA(res)); px_hmac_free(h); @@ -228,20 +228,20 @@ pg_encrypt(PG_FUNCTION_ARGS) klen, rlen; - type = PG_GETARG_TEXT_P(2); + type = PG_GETARG_TEXT_PP(2); c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); - dlen = VARSIZE(data) - VARHDRSZ; - klen = VARSIZE(key) - VARHDRSZ; + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); + dlen = VARSIZE_ANY_EXHDR(data); + klen = VARSIZE_ANY_EXHDR(key); rlen = px_combo_encrypt_len(c, dlen); res = palloc(VARHDRSZ + rlen); - err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0); + err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0); if (!err) - err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen, + err = px_combo_encrypt(c, (uint8 *) VARDATA_ANY(data), dlen, (uint8 *) VARDATA(res), &rlen); px_combo_free(c); @@ -277,20 +277,20 @@ pg_decrypt(PG_FUNCTION_ARGS) klen, rlen; - type = PG_GETARG_TEXT_P(2); + type = PG_GETARG_TEXT_PP(2); c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); - dlen = VARSIZE(data) - VARHDRSZ; - klen = VARSIZE(key) - VARHDRSZ; + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); + dlen = VARSIZE_ANY_EXHDR(data); + klen = VARSIZE_ANY_EXHDR(key); rlen = px_combo_decrypt_len(c, dlen); res = palloc(VARHDRSZ + rlen); - err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0); + err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0); if (!err) - err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen, + err = px_combo_decrypt(c, (uint8 *) VARDATA_ANY(data), dlen, (uint8 *) VARDATA(res), &rlen); px_combo_free(c); @@ -327,23 +327,23 @@ pg_encrypt_iv(PG_FUNCTION_ARGS) ivlen, rlen; - type = PG_GETARG_TEXT_P(3); + type = PG_GETARG_TEXT_PP(3); c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); - iv = PG_GETARG_BYTEA_P(2); - dlen = VARSIZE(data) - VARHDRSZ; - klen = VARSIZE(key) - VARHDRSZ; - ivlen = VARSIZE(iv) - VARHDRSZ; + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); + iv = PG_GETARG_BYTEA_PP(2); + dlen = VARSIZE_ANY_EXHDR(data); + klen = VARSIZE_ANY_EXHDR(key); + ivlen = VARSIZE_ANY_EXHDR(iv); rlen = px_combo_encrypt_len(c, dlen); res = palloc(VARHDRSZ + rlen); - err = px_combo_init(c, (uint8 *) VARDATA(key), klen, - (uint8 *) VARDATA(iv), ivlen); + err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, + (uint8 *) VARDATA_ANY(iv), ivlen); if (!err) - err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen, + err = px_combo_encrypt(c, (uint8 *) VARDATA_ANY(data), dlen, (uint8 *) VARDATA(res), &rlen); px_combo_free(c); @@ -381,23 +381,23 @@ pg_decrypt_iv(PG_FUNCTION_ARGS) rlen, ivlen; - type = PG_GETARG_TEXT_P(3); + type = PG_GETARG_TEXT_PP(3); c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); - iv = PG_GETARG_BYTEA_P(2); - dlen = VARSIZE(data) - VARHDRSZ; - klen = VARSIZE(key) - VARHDRSZ; - ivlen = VARSIZE(iv) - VARHDRSZ; + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); + iv = PG_GETARG_BYTEA_PP(2); + dlen = VARSIZE_ANY_EXHDR(data); + klen = VARSIZE_ANY_EXHDR(key); + ivlen = VARSIZE_ANY_EXHDR(iv); rlen = px_combo_decrypt_len(c, dlen); res = palloc(VARHDRSZ + rlen); - err = px_combo_init(c, (uint8 *) VARDATA(key), klen, - (uint8 *) VARDATA(iv), ivlen); + err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, + (uint8 *) VARDATA_ANY(iv), ivlen); if (!err) - err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen, + err = px_combo_decrypt(c, (uint8 *) VARDATA_ANY(data), dlen, (uint8 *) VARDATA(res), &rlen); px_combo_free(c); @@ -480,8 +480,8 @@ find_provider(text *name, char *buf; int err; - buf = downcase_truncate_identifier(VARDATA(name), - VARSIZE(name) - VARHDRSZ, + buf = downcase_truncate_identifier(VARDATA_ANY(name), + VARSIZE_ANY_EXHDR(name), false); err = provider_lookup(buf, &res); diff --git a/contrib/pgcrypto/pgp-pgsql.c b/contrib/pgcrypto/pgp-pgsql.c index ce16db71d8..cc5df14725 100644 --- a/contrib/pgcrypto/pgp-pgsql.c +++ b/contrib/pgcrypto/pgp-pgsql.c @@ -67,9 +67,9 @@ PG_FUNCTION_INFO_V1(pgp_armor_headers); static text * convert_charset(text *src, int cset_from, int cset_to) { - int src_len = VARSIZE(src) - VARHDRSZ; + int src_len = VARSIZE_ANY_EXHDR(src); unsigned char *dst; - unsigned char *csrc = (unsigned char *) VARDATA(src); + unsigned char *csrc = (unsigned char *) VARDATA_ANY(src); text *res; dst = pg_do_encoding_conversion(csrc, src_len, cset_from, cset_to); @@ -109,7 +109,7 @@ string_is_ascii(const char *str) static void clear_and_pfree(text *p) { - px_memset(p, 0, VARSIZE(p)); + px_memset(p, 0, VARSIZE_ANY(p)); pfree(p); } @@ -356,8 +356,8 @@ parse_args(PGP_Context *ctx, uint8 *args, int arg_len, static MBuf * create_mbuf_from_vardata(text *data) { - return mbuf_create_from_data((uint8 *) VARDATA(data), - VARSIZE(data) - VARHDRSZ); + return mbuf_create_from_data((uint8 *) VARDATA_ANY(data), + VARSIZE_ANY_EXHDR(data)); } static void @@ -369,8 +369,8 @@ init_work(PGP_Context **ctx_p, int is_text, fill_expect(ex, is_text); if (err == 0 && args != NULL) - err = parse_args(*ctx_p, (uint8 *) VARDATA(args), - VARSIZE(args) - VARHDRSZ, ex); + err = parse_args(*ctx_p, (uint8 *) VARDATA_ANY(args), + VARSIZE_ANY_EXHDR(args), ex); if (err) px_THROW_ERROR(err); @@ -408,7 +408,7 @@ encrypt_internal(int is_pubenc, int is_text, } src = create_mbuf_from_vardata(data); - dst = mbuf_create(VARSIZE(data) + 128); + dst = mbuf_create(VARSIZE_ANY(data) + 128); /* * reserve room for header @@ -427,8 +427,8 @@ encrypt_internal(int is_pubenc, int is_text, mbuf_free(kbuf); } else - err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key), - VARSIZE(key) - VARHDRSZ); + err = pgp_set_symkey(ctx, (uint8 *) VARDATA_ANY(key), + VARSIZE_ANY_EXHDR(key)); /* * encrypt @@ -485,9 +485,9 @@ decrypt_internal(int is_pubenc, int need_text, text *data, init_work(&ctx, need_text, args, &ex); - src = mbuf_create_from_data((uint8 *) VARDATA(data), - VARSIZE(data) - VARHDRSZ); - dst = mbuf_create(VARSIZE(data) + 2048); + src = mbuf_create_from_data((uint8 *) VARDATA_ANY(data), + VARSIZE_ANY_EXHDR(data)); + dst = mbuf_create(VARSIZE_ANY(data) + 2048); /* * reserve room for header @@ -505,16 +505,16 @@ decrypt_internal(int is_pubenc, int need_text, text *data, if (keypsw) { - psw = (uint8 *) VARDATA(keypsw); - psw_len = VARSIZE(keypsw) - VARHDRSZ; + psw = (uint8 *) VARDATA_ANY(keypsw); + psw_len = VARSIZE_ANY_EXHDR(keypsw); } kbuf = create_mbuf_from_vardata(key); err = pgp_set_pubkey(ctx, kbuf, psw, psw_len, 1); mbuf_free(kbuf); } else - err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key), - VARSIZE(key) - VARHDRSZ); + err = pgp_set_symkey(ctx, (uint8 *) VARDATA_ANY(key), + VARSIZE_ANY_EXHDR(key)); /* decrypt */ if (err >= 0) @@ -571,10 +571,10 @@ pgp_sym_encrypt_bytea(PG_FUNCTION_ARGS) text *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - arg = PG_GETARG_BYTEA_P(2); + arg = PG_GETARG_BYTEA_PP(2); res = encrypt_internal(0, 0, data, key, arg); @@ -593,10 +593,10 @@ pgp_sym_encrypt_text(PG_FUNCTION_ARGS) text *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - arg = PG_GETARG_BYTEA_P(2); + arg = PG_GETARG_BYTEA_PP(2); res = encrypt_internal(0, 1, data, key, arg); @@ -616,10 +616,10 @@ pgp_sym_decrypt_bytea(PG_FUNCTION_ARGS) text *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - arg = PG_GETARG_BYTEA_P(2); + arg = PG_GETARG_BYTEA_PP(2); res = decrypt_internal(0, 0, data, key, NULL, arg); @@ -638,10 +638,10 @@ pgp_sym_decrypt_text(PG_FUNCTION_ARGS) text *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - arg = PG_GETARG_BYTEA_P(2); + arg = PG_GETARG_BYTEA_PP(2); res = decrypt_internal(0, 1, data, key, NULL, arg); @@ -664,10 +664,10 @@ pgp_pub_encrypt_bytea(PG_FUNCTION_ARGS) text *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - arg = PG_GETARG_BYTEA_P(2); + arg = PG_GETARG_BYTEA_PP(2); res = encrypt_internal(1, 0, data, key, arg); @@ -686,10 +686,10 @@ pgp_pub_encrypt_text(PG_FUNCTION_ARGS) text *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - arg = PG_GETARG_BYTEA_P(2); + arg = PG_GETARG_BYTEA_PP(2); res = encrypt_internal(1, 1, data, key, arg); @@ -710,12 +710,12 @@ pgp_pub_decrypt_bytea(PG_FUNCTION_ARGS) *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - psw = PG_GETARG_BYTEA_P(2); + psw = PG_GETARG_BYTEA_PP(2); if (PG_NARGS() > 3) - arg = PG_GETARG_BYTEA_P(3); + arg = PG_GETARG_BYTEA_PP(3); res = decrypt_internal(1, 0, data, key, psw, arg); @@ -737,12 +737,12 @@ pgp_pub_decrypt_text(PG_FUNCTION_ARGS) *arg = NULL; text *res; - data = PG_GETARG_BYTEA_P(0); - key = PG_GETARG_BYTEA_P(1); + data = PG_GETARG_BYTEA_PP(0); + key = PG_GETARG_BYTEA_PP(1); if (PG_NARGS() > 2) - psw = PG_GETARG_BYTEA_P(2); + psw = PG_GETARG_BYTEA_PP(2); if (PG_NARGS() > 3) - arg = PG_GETARG_BYTEA_P(3); + arg = PG_GETARG_BYTEA_PP(3); res = decrypt_internal(1, 1, data, key, psw, arg); @@ -865,8 +865,8 @@ pg_armor(PG_FUNCTION_ARGS) char **keys = NULL, **values = NULL; - data = PG_GETARG_BYTEA_P(0); - data_len = VARSIZE(data) - VARHDRSZ; + data = PG_GETARG_BYTEA_PP(0); + data_len = VARSIZE_ANY_EXHDR(data); if (PG_NARGS() == 3) { num_headers = parse_key_value_arrays(PG_GETARG_ARRAYTYPE_P(1), @@ -880,7 +880,7 @@ pg_armor(PG_FUNCTION_ARGS) initStringInfo(&buf); - pgp_armor_encode((uint8 *) VARDATA(data), data_len, &buf, + pgp_armor_encode((uint8 *) VARDATA_ANY(data), data_len, &buf, num_headers, keys, values); res = palloc(VARHDRSZ + buf.len); @@ -901,12 +901,12 @@ pg_dearmor(PG_FUNCTION_ARGS) int ret; StringInfoData buf; - data = PG_GETARG_TEXT_P(0); - data_len = VARSIZE(data) - VARHDRSZ; + data = PG_GETARG_TEXT_PP(0); + data_len = VARSIZE_ANY_EXHDR(data); initStringInfo(&buf); - ret = pgp_armor_decode((uint8 *) VARDATA(data), data_len, &buf); + ret = pgp_armor_decode((uint8 *) VARDATA_ANY(data), data_len, &buf); if (ret < 0) px_THROW_ERROR(ret); res = palloc(VARHDRSZ + buf.len); @@ -1004,7 +1004,7 @@ pgp_key_id_w(PG_FUNCTION_ARGS) int res_len; MBuf *buf; - data = PG_GETARG_BYTEA_P(0); + data = PG_GETARG_BYTEA_PP(0); buf = create_mbuf_from_vardata(data); res = palloc(VARHDRSZ + 17); diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c index 4d49610641..db9e0349a0 100644 --- a/contrib/pgrowlocks/pgrowlocks.c +++ b/contrib/pgrowlocks/pgrowlocks.c @@ -94,7 +94,7 @@ pgrowlocks(PG_FUNCTION_ARGS) attinmeta = TupleDescGetAttInMetadata(tupdesc); funcctx->attinmeta = attinmeta; - relname = PG_GETARG_TEXT_P(0); + relname = PG_GETARG_TEXT_PP(0); relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname)); rel = heap_openrv(relrv, AccessShareLock); diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c index c69f9ec093..d448e9ede6 100644 --- a/contrib/pgstattuple/pgstatindex.c +++ b/contrib/pgstattuple/pgstatindex.c @@ -143,7 +143,7 @@ static void check_relation_relkind(Relation rel); Datum pgstatindex(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); Relation rel; RangeVar *relrv; @@ -168,7 +168,7 @@ pgstatindex(PG_FUNCTION_ARGS) Datum pgstatindex_v1_5(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); Relation rel; RangeVar *relrv; @@ -377,7 +377,7 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo) Datum pg_relpages(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); int64 relpages; Relation rel; RangeVar *relrv; @@ -406,7 +406,7 @@ pg_relpages(PG_FUNCTION_ARGS) Datum pg_relpages_v1_5(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); int64 relpages; Relation rel; RangeVar *relrv; diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c index b2432f43ed..1e0de5d660 100644 --- a/contrib/pgstattuple/pgstattuple.c +++ b/contrib/pgstattuple/pgstattuple.c @@ -165,7 +165,7 @@ build_pgstattuple_type(pgstattuple_type *stat, FunctionCallInfo fcinfo) Datum pgstattuple(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); RangeVar *relrv; Relation rel; @@ -191,7 +191,7 @@ pgstattuple(PG_FUNCTION_ARGS) Datum pgstattuple_v1_5(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); RangeVar *relrv; Relation rel; diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 82deb93093..1a8f8848f5 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -590,7 +590,7 @@ PG_FUNCTION_INFO_V1(sepgsql_mcstrans_in); Datum sepgsql_mcstrans_in(PG_FUNCTION_ARGS) { - text *label = PG_GETARG_TEXT_P(0); + text *label = PG_GETARG_TEXT_PP(0); char *raw_label; char *result; @@ -630,7 +630,7 @@ PG_FUNCTION_INFO_V1(sepgsql_mcstrans_out); Datum sepgsql_mcstrans_out(PG_FUNCTION_ARGS) { - text *label = PG_GETARG_TEXT_P(0); + text *label = PG_GETARG_TEXT_PP(0); char *qual_label; char *result; diff --git a/contrib/spi/autoinc.c b/contrib/spi/autoinc.c index 54f85a3709..8bf742230e 100644 --- a/contrib/spi/autoinc.c +++ b/contrib/spi/autoinc.c @@ -106,7 +106,7 @@ autoinc(PG_FUNCTION_ARGS) newvals[chnattrs] = Int32GetDatum((int32) DatumGetInt64(newvals[chnattrs])); } newnulls[chnattrs] = false; - pfree(DatumGetTextP(seqname)); + pfree(DatumGetTextPP(seqname)); chnattrs++; i++; } diff --git a/contrib/sslinfo/sslinfo.c b/contrib/sslinfo/sslinfo.c index a4b0f9b6a1..42846436eb 100644 --- a/contrib/sslinfo/sslinfo.c +++ b/contrib/sslinfo/sslinfo.c @@ -225,7 +225,7 @@ PG_FUNCTION_INFO_V1(ssl_client_dn_field); Datum ssl_client_dn_field(PG_FUNCTION_ARGS) { - text *fieldname = PG_GETARG_TEXT_P(0); + text *fieldname = PG_GETARG_TEXT_PP(0); Datum result; if (!(MyProcPort->peer)) @@ -260,7 +260,7 @@ PG_FUNCTION_INFO_V1(ssl_issuer_field); Datum ssl_issuer_field(PG_FUNCTION_ARGS) { - text *fieldname = PG_GETARG_TEXT_P(0); + text *fieldname = PG_GETARG_TEXT_PP(0); Datum result; if (!(MyProcPort->peer)) diff --git a/contrib/unaccent/unaccent.c b/contrib/unaccent/unaccent.c index 542e7267be..6a34cfd3ed 100644 --- a/contrib/unaccent/unaccent.c +++ b/contrib/unaccent/unaccent.c @@ -384,14 +384,14 @@ unaccent_dict(PG_FUNCTION_ARGS) dictOid = PG_GETARG_OID(0); strArg = 1; } - str = PG_GETARG_TEXT_P(strArg); + str = PG_GETARG_TEXT_PP(strArg); dict = lookup_ts_dictionary_cache(dictOid); res = (TSLexeme *) DatumGetPointer(FunctionCall4(&(dict->lexize), PointerGetDatum(dict->dictData), - PointerGetDatum(VARDATA(str)), - Int32GetDatum(VARSIZE(str) - VARHDRSZ), + PointerGetDatum(VARDATA_ANY(str)), + Int32GetDatum(VARSIZE_ANY_EXHDR(str)), PointerGetDatum(NULL))); PG_FREE_IF_COPY(str, strArg); diff --git a/contrib/uuid-ossp/uuid-ossp.c b/contrib/uuid-ossp/uuid-ossp.c index 57bdf4d8d4..1ce08555cf 100644 --- a/contrib/uuid-ossp/uuid-ossp.c +++ b/contrib/uuid-ossp/uuid-ossp.c @@ -503,13 +503,13 @@ Datum uuid_generate_v3(PG_FUNCTION_ARGS) { pg_uuid_t *ns = PG_GETARG_UUID_P(0); - text *name = PG_GETARG_TEXT_P(1); + text *name = PG_GETARG_TEXT_PP(1); #ifdef HAVE_UUID_OSSP return uuid_generate_v35_internal(UUID_MAKE_V3, ns, name); #else return uuid_generate_internal(UUID_MAKE_V3, (unsigned char *) ns, - VARDATA(name), VARSIZE(name) - VARHDRSZ); + VARDATA_ANY(name), VARSIZE_ANY_EXHDR(name)); #endif } @@ -525,12 +525,12 @@ Datum uuid_generate_v5(PG_FUNCTION_ARGS) { pg_uuid_t *ns = PG_GETARG_UUID_P(0); - text *name = PG_GETARG_TEXT_P(1); + text *name = PG_GETARG_TEXT_PP(1); #ifdef HAVE_UUID_OSSP return uuid_generate_v35_internal(UUID_MAKE_V5, ns, name); #else return uuid_generate_internal(UUID_MAKE_V5, (unsigned char *) ns, - VARDATA(name), VARSIZE(name) - VARHDRSZ); + VARDATA_ANY(name), VARSIZE_ANY_EXHDR(name)); #endif } diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 73b74c875e..034545caa8 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -95,9 +95,9 @@ PG_FUNCTION_INFO_V1(xml_is_well_formed); Datum xml_is_well_formed(PG_FUNCTION_ARGS) { - text *t = PG_GETARG_TEXT_P(0); /* document buffer */ + text *t = PG_GETARG_TEXT_PP(0); /* document buffer */ bool result = false; - int32 docsize = VARSIZE(t) - VARHDRSZ; + int32 docsize = VARSIZE_ANY_EXHDR(t); xmlDocPtr doctree; PgXmlErrorContext *xmlerrcxt; @@ -105,7 +105,7 @@ xml_is_well_formed(PG_FUNCTION_ARGS) PG_TRY(); { - doctree = xmlParseMemory((char *) VARDATA(t), docsize); + doctree = xmlParseMemory((char *) VARDATA_ANY(t), docsize); result = (doctree != NULL); @@ -133,7 +133,7 @@ PG_FUNCTION_INFO_V1(xml_encode_special_chars); Datum xml_encode_special_chars(PG_FUNCTION_ARGS) { - text *tin = PG_GETARG_TEXT_P(0); + text *tin = PG_GETARG_TEXT_PP(0); text *tout; xmlChar *ts, *tt; @@ -248,10 +248,10 @@ PG_FUNCTION_INFO_V1(xpath_nodeset); Datum xpath_nodeset(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ - xmlChar *toptag = pgxml_texttoxmlchar(PG_GETARG_TEXT_P(2)); - xmlChar *septag = pgxml_texttoxmlchar(PG_GETARG_TEXT_P(3)); + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + xmlChar *toptag = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(2)); + xmlChar *septag = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(3)); xmlChar *xpath; text *xpres; xmlXPathObjectPtr res; @@ -281,9 +281,9 @@ PG_FUNCTION_INFO_V1(xpath_list); Datum xpath_list(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ - xmlChar *plainsep = pgxml_texttoxmlchar(PG_GETARG_TEXT_P(2)); + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + xmlChar *plainsep = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(2)); xmlChar *xpath; text *xpres; xmlXPathObjectPtr res; @@ -310,15 +310,15 @@ PG_FUNCTION_INFO_V1(xpath_string); Datum xpath_string(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; int32 pathsize; text *xpres; xmlXPathObjectPtr res; xpath_workspace workspace; - pathsize = VARSIZE(xpathsupp) - VARHDRSZ; + pathsize = VARSIZE_ANY_EXHDR(xpathsupp); /* * We encapsulate the supplied path with "string()" = 8 chars + 1 for NUL @@ -328,7 +328,7 @@ xpath_string(PG_FUNCTION_ARGS) xpath = (xmlChar *) palloc(pathsize + 9); memcpy((char *) xpath, "string(", 7); - memcpy((char *) (xpath + 7), VARDATA(xpathsupp), pathsize); + memcpy((char *) (xpath + 7), VARDATA_ANY(xpathsupp), pathsize); xpath[pathsize + 7] = ')'; xpath[pathsize + 8] = '\0'; @@ -351,8 +351,8 @@ PG_FUNCTION_INFO_V1(xpath_number); Datum xpath_number(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; float4 fRes; xmlXPathObjectPtr res; @@ -383,8 +383,8 @@ PG_FUNCTION_INFO_V1(xpath_bool); Datum xpath_bool(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; int bRes; xmlXPathObjectPtr res; @@ -413,7 +413,7 @@ xpath_bool(PG_FUNCTION_ARGS) static xmlXPathObjectPtr pgxml_xpath(text *document, xmlChar *xpath, xpath_workspace *workspace) { - int32 docsize = VARSIZE(document) - VARHDRSZ; + int32 docsize = VARSIZE_ANY_EXHDR(document); PgXmlErrorContext *xmlerrcxt; xmlXPathCompExprPtr comppath; @@ -425,7 +425,7 @@ pgxml_xpath(text *document, xmlChar *xpath, xpath_workspace *workspace) PG_TRY(); { - workspace->doctree = xmlParseMemory((char *) VARDATA(document), + workspace->doctree = xmlParseMemory((char *) VARDATA_ANY(document), docsize); if (workspace->doctree != NULL) { diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c index 343924e991..391e6b593b 100644 --- a/contrib/xml2/xslt_proc.c +++ b/contrib/xml2/xslt_proc.c @@ -49,8 +49,8 @@ xslt_process(PG_FUNCTION_ARGS) { #ifdef USE_LIBXSLT - text *doct = PG_GETARG_TEXT_P(0); - text *ssheet = PG_GETARG_TEXT_P(1); + text *doct = PG_GETARG_TEXT_PP(0); + text *ssheet = PG_GETARG_TEXT_PP(1); text *result; text *paramstr; const char **params; @@ -66,7 +66,7 @@ xslt_process(PG_FUNCTION_ARGS) if (fcinfo->nargs == 3) { - paramstr = PG_GETARG_TEXT_P(2); + paramstr = PG_GETARG_TEXT_PP(2); params = parse_params(paramstr); } else @@ -85,16 +85,16 @@ xslt_process(PG_FUNCTION_ARGS) bool xslt_sec_prefs_error; /* Parse document */ - doctree = xmlParseMemory((char *) VARDATA(doct), - VARSIZE(doct) - VARHDRSZ); + doctree = xmlParseMemory((char *) VARDATA_ANY(doct), + VARSIZE_ANY_EXHDR(doct)); if (doctree == NULL) xml_ereport(xmlerrcxt, ERROR, ERRCODE_EXTERNAL_ROUTINE_EXCEPTION, "error parsing XML document"); /* Same for stylesheet */ - ssdoc = xmlParseMemory((char *) VARDATA(ssheet), - VARSIZE(ssheet) - VARHDRSZ); + ssdoc = xmlParseMemory((char *) VARDATA_ANY(ssheet), + VARSIZE_ANY_EXHDR(ssheet)); if (ssdoc == NULL) xml_ereport(xmlerrcxt, ERROR, ERRCODE_EXTERNAL_ROUTINE_EXCEPTION, diff --git a/src/backend/access/spgist/spgtextproc.c b/src/backend/access/spgist/spgtextproc.c index 86788549a5..53f298b6c2 100644 --- a/src/backend/access/spgist/spgtextproc.c +++ b/src/backend/access/spgist/spgtextproc.c @@ -568,8 +568,9 @@ spg_text_leaf_consistent(PG_FUNCTION_ARGS) leafValue = DatumGetTextPP(in->leafDatum); + /* As above, in->reconstructedValue isn't toasted or short. */ if (DatumGetPointer(in->reconstructedValue)) - reconstrValue = DatumGetTextP(in->reconstructedValue); + reconstrValue = (text *) DatumGetPointer(in->reconstructedValue); Assert(reconstrValue == NULL ? level == 0 : VARSIZE_ANY_EXHDR(reconstrValue) == level); diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index 27c0c561a8..96aa15e9cc 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -72,7 +72,7 @@ nonexclusive_base_backup_cleanup(int code, Datum arg) Datum pg_start_backup(PG_FUNCTION_ARGS) { - text *backupid = PG_GETARG_TEXT_P(0); + text *backupid = PG_GETARG_TEXT_PP(0); bool fast = PG_GETARG_BOOL(1); bool exclusive = PG_GETARG_BOOL(2); char *backupidstr; @@ -309,7 +309,7 @@ pg_switch_wal(PG_FUNCTION_ARGS) Datum pg_create_restore_point(PG_FUNCTION_ARGS) { - text *restore_name = PG_GETARG_TEXT_P(0); + text *restore_name = PG_GETARG_TEXT_PP(0); char *restore_name_str; XLogRecPtr restorepoint; diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 585fcce98e..86a84ee234 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -2317,7 +2317,7 @@ Datum pg_extension_config_dump(PG_FUNCTION_ARGS) { Oid tableoid = PG_GETARG_OID(0); - text *wherecond = PG_GETARG_TEXT_P(1); + text *wherecond = PG_GETARG_TEXT_PP(1); char *tablename; Relation extRel; ScanKeyData key[1]; diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 5820fee5a3..d547db714e 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -538,7 +538,7 @@ DeleteSequenceTuple(Oid relid) Datum nextval(PG_FUNCTION_ARGS) { - text *seqin = PG_GETARG_TEXT_P(0); + text *seqin = PG_GETARG_TEXT_PP(0); RangeVar *sequence; Oid relid; diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index d80bff671c..a1bb3e958c 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -1673,13 +1673,13 @@ RelationBuildTriggers(Relation relation) bytea *val; char *p; - val = DatumGetByteaP(fastgetattr(htup, - Anum_pg_trigger_tgargs, - tgrel->rd_att, &isnull)); + val = DatumGetByteaPP(fastgetattr(htup, + Anum_pg_trigger_tgargs, + tgrel->rd_att, &isnull)); if (isnull) elog(ERROR, "tgargs is null in trigger for relation \"%s\"", RelationGetRelationName(relation)); - p = (char *) VARDATA(val); + p = (char *) VARDATA_ANY(val); build->tgargs = (char **) palloc(build->tgnargs * sizeof(char *)); for (i = 0; i < build->tgnargs; i++) { diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c index 49668be0d7..b58d60c855 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -1561,9 +1561,9 @@ serialize_deflist(List *deflist) List * deserialize_deflist(Datum txt) { - text *in = DatumGetTextP(txt); /* in case it's toasted */ + text *in = DatumGetTextPP(txt); /* in case it's toasted */ List *result = NIL; - int len = VARSIZE(in) - VARHDRSZ; + int len = VARSIZE_ANY_EXHDR(in); char *ptr, *endptr, *workspace, @@ -1583,7 +1583,7 @@ deserialize_deflist(Datum txt) ds_state state = CS_WAITKEY; workspace = (char *) palloc(len + 1); /* certainly enough room */ - ptr = VARDATA(in); + ptr = VARDATA_ANY(in); endptr = ptr + len; for (; ptr < endptr; ptr++) { diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index 4ff0188bcc..90bef6f01f 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -3440,7 +3440,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext, value = ExecEvalExpr(e, econtext, &isnull); if (isnull) return (Datum) 0; - data = DatumGetTextP(value); + data = DatumGetTextPP(value); e = (ExprState *) lsecond(xmlExpr->args); value = ExecEvalExpr(e, econtext, &isnull); @@ -3471,7 +3471,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext, if (isnull) arg = NULL; else - arg = DatumGetTextP(value); + arg = DatumGetTextPP(value); } else { @@ -3504,7 +3504,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext, if (isnull) version = NULL; else - version = DatumGetTextP(value); + version = DatumGetTextPP(value); e = (ExprState *) lthird(xmlExpr->args); value = ExecEvalExpr(e, econtext, &isnull); diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c index f537affdd9..2cb6039385 100644 --- a/src/backend/libpq/be-fsstubs.c +++ b/src/backend/libpq/be-fsstubs.c @@ -399,12 +399,12 @@ Datum be_lowrite(PG_FUNCTION_ARGS) { int32 fd = PG_GETARG_INT32(0); - bytea *wbuf = PG_GETARG_BYTEA_P(1); + bytea *wbuf = PG_GETARG_BYTEA_PP(1); int bytestowrite; int totalwritten; - bytestowrite = VARSIZE(wbuf) - VARHDRSZ; - totalwritten = lo_write(fd, VARDATA(wbuf), bytestowrite); + bytestowrite = VARSIZE_ANY_EXHDR(wbuf); + totalwritten = lo_write(fd, VARDATA_ANY(wbuf), bytestowrite); PG_RETURN_INT32(totalwritten); } diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c index bf84c68a0c..5eaf863e02 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -1307,7 +1307,7 @@ pg_replication_origin_xact_reset(PG_FUNCTION_ARGS) Datum pg_replication_origin_advance(PG_FUNCTION_ARGS) { - text *name = PG_GETARG_TEXT_P(0); + text *name = PG_GETARG_TEXT_PP(0); XLogRecPtr remote_commit = PG_GETARG_LSN(1); RepOriginId node; diff --git a/src/backend/tsearch/dict.c b/src/backend/tsearch/dict.c index 87ee8bfe2e..ba8a3d79a8 100644 --- a/src/backend/tsearch/dict.c +++ b/src/backend/tsearch/dict.c @@ -26,7 +26,7 @@ Datum ts_lexize(PG_FUNCTION_ARGS) { Oid dictId = PG_GETARG_OID(0); - text *in = PG_GETARG_TEXT_P(1); + text *in = PG_GETARG_TEXT_PP(1); ArrayType *a; TSDictionaryCacheEntry *dict; TSLexeme *res, @@ -38,8 +38,8 @@ ts_lexize(PG_FUNCTION_ARGS) res = (TSLexeme *) DatumGetPointer(FunctionCall4(&dict->lexize, PointerGetDatum(dict->dictData), - PointerGetDatum(VARDATA(in)), - Int32GetDatum(VARSIZE(in) - VARHDRSZ), + PointerGetDatum(VARDATA_ANY(in)), + Int32GetDatum(VARSIZE_ANY_EXHDR(in)), PointerGetDatum(&dstate))); if (dstate.getnext) @@ -47,8 +47,8 @@ ts_lexize(PG_FUNCTION_ARGS) dstate.isend = true; ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&dict->lexize, PointerGetDatum(dict->dictData), - PointerGetDatum(VARDATA(in)), - Int32GetDatum(VARSIZE(in) - VARHDRSZ), + PointerGetDatum(VARDATA_ANY(in)), + Int32GetDatum(VARSIZE_ANY_EXHDR(in)), PointerGetDatum(&dstate))); if (ptr != NULL) res = ptr; diff --git a/src/backend/tsearch/to_tsany.c b/src/backend/tsearch/to_tsany.c index 6e5de8f920..398a781c03 100644 --- a/src/backend/tsearch/to_tsany.c +++ b/src/backend/tsearch/to_tsany.c @@ -216,19 +216,19 @@ Datum to_tsvector_byid(PG_FUNCTION_ARGS) { Oid cfgId = PG_GETARG_OID(0); - text *in = PG_GETARG_TEXT_P(1); + text *in = PG_GETARG_TEXT_PP(1); ParsedText prs; TSVector out; - prs.lenwords = (VARSIZE(in) - VARHDRSZ) / 6; /* just estimation of - * word's number */ + prs.lenwords = VARSIZE_ANY_EXHDR(in) / 6; /* just estimation of word's + * number */ if (prs.lenwords == 0) prs.lenwords = 2; prs.curwords = 0; prs.pos = 0; prs.words = (ParsedWord *) palloc(sizeof(ParsedWord) * prs.lenwords); - parsetext(cfgId, &prs, VARDATA(in), VARSIZE(in) - VARHDRSZ); + parsetext(cfgId, &prs, VARDATA_ANY(in), VARSIZE_ANY_EXHDR(in)); PG_FREE_IF_COPY(in, 1); if (prs.curwords) @@ -247,7 +247,7 @@ to_tsvector_byid(PG_FUNCTION_ARGS) Datum to_tsvector(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(0); + text *in = PG_GETARG_TEXT_PP(0); Oid cfgId; cfgId = getTSCurrentConfig(true); @@ -362,7 +362,7 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, Datum to_tsquery_byid(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(1); + text *in = PG_GETARG_TEXT_PP(1); TSQuery query; MorphOpaque data; @@ -380,7 +380,7 @@ to_tsquery_byid(PG_FUNCTION_ARGS) Datum to_tsquery(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(0); + text *in = PG_GETARG_TEXT_PP(0); Oid cfgId; cfgId = getTSCurrentConfig(true); @@ -392,7 +392,7 @@ to_tsquery(PG_FUNCTION_ARGS) Datum plainto_tsquery_byid(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(1); + text *in = PG_GETARG_TEXT_PP(1); TSQuery query; MorphOpaque data; @@ -410,7 +410,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS) Datum plainto_tsquery(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(0); + text *in = PG_GETARG_TEXT_PP(0); Oid cfgId; cfgId = getTSCurrentConfig(true); @@ -423,7 +423,7 @@ plainto_tsquery(PG_FUNCTION_ARGS) Datum phraseto_tsquery_byid(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(1); + text *in = PG_GETARG_TEXT_PP(1); TSQuery query; MorphOpaque data; @@ -441,7 +441,7 @@ phraseto_tsquery_byid(PG_FUNCTION_ARGS) Datum phraseto_tsquery(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(0); + text *in = PG_GETARG_TEXT_PP(0); Oid cfgId; cfgId = getTSCurrentConfig(true); diff --git a/src/backend/tsearch/wparser.c b/src/backend/tsearch/wparser.c index 8ca1c62713..d8f2f65542 100644 --- a/src/backend/tsearch/wparser.c +++ b/src/backend/tsearch/wparser.c @@ -123,7 +123,7 @@ ts_token_type_byname(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { - text *prsname = PG_GETARG_TEXT_P(0); + text *prsname = PG_GETARG_TEXT_PP(0); Oid prsId; funcctx = SRF_FIRSTCALL_INIT(); @@ -172,8 +172,8 @@ prs_setup_firstcall(FuncCallContext *funcctx, Oid prsid, text *txt) st->list = (LexemeEntry *) palloc(sizeof(LexemeEntry) * st->len); prsdata = (void *) DatumGetPointer(FunctionCall2(&prs->prsstart, - PointerGetDatum(VARDATA(txt)), - Int32GetDatum(VARSIZE(txt) - VARHDRSZ))); + PointerGetDatum(VARDATA_ANY(txt)), + Int32GetDatum(VARSIZE_ANY_EXHDR(txt)))); while ((type = DatumGetInt32(FunctionCall3(&prs->prstoken, PointerGetDatum(prsdata), @@ -248,7 +248,7 @@ ts_parse_byid(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { - text *txt = PG_GETARG_TEXT_P(1); + text *txt = PG_GETARG_TEXT_PP(1); funcctx = SRF_FIRSTCALL_INIT(); prs_setup_firstcall(funcctx, PG_GETARG_OID(0), txt); @@ -270,8 +270,8 @@ ts_parse_byname(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { - text *prsname = PG_GETARG_TEXT_P(0); - text *txt = PG_GETARG_TEXT_P(1); + text *prsname = PG_GETARG_TEXT_PP(0); + text *txt = PG_GETARG_TEXT_PP(1); Oid prsId; funcctx = SRF_FIRSTCALL_INIT(); @@ -289,9 +289,9 @@ ts_parse_byname(PG_FUNCTION_ARGS) Datum ts_headline_byid_opt(PG_FUNCTION_ARGS) { - text *in = PG_GETARG_TEXT_P(1); + text *in = PG_GETARG_TEXT_PP(1); TSQuery query = PG_GETARG_TSQUERY(2); - text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL; + text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_PP(3) : NULL; HeadlineParsedText prs; List *prsoptions; text *out; @@ -310,7 +310,8 @@ ts_headline_byid_opt(PG_FUNCTION_ARGS) prs.lenwords = 32; prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords); - hlparsetext(cfg->cfgId, &prs, query, VARDATA(in), VARSIZE(in) - VARHDRSZ); + hlparsetext(cfg->cfgId, &prs, query, + VARDATA_ANY(in), VARSIZE_ANY_EXHDR(in)); if (opt) prsoptions = deserialize_deflist(PointerGetDatum(opt)); diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index fca8420b01..35bdfc9a46 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -1559,7 +1559,7 @@ makeaclitem(PG_FUNCTION_ARGS) { Oid grantee = PG_GETARG_OID(0); Oid grantor = PG_GETARG_OID(1); - text *privtext = PG_GETARG_TEXT_P(2); + text *privtext = PG_GETARG_TEXT_PP(2); bool goption = PG_GETARG_BOOL(3); AclItem *result; AclMode priv; @@ -1835,8 +1835,8 @@ Datum has_table_privilege_name_name(PG_FUNCTION_ARGS) { Name rolename = PG_GETARG_NAME(0); - text *tablename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *tablename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid tableoid; AclMode mode; @@ -1860,8 +1860,8 @@ has_table_privilege_name_name(PG_FUNCTION_ARGS) Datum has_table_privilege_name(PG_FUNCTION_ARGS) { - text *tablename = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *tablename = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid tableoid; AclMode mode; @@ -1886,7 +1886,7 @@ has_table_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid tableoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -1912,7 +1912,7 @@ Datum has_table_privilege_id(PG_FUNCTION_ARGS) { Oid tableoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -1937,8 +1937,8 @@ Datum has_table_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *tablename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *tablename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid tableoid; AclMode mode; AclResult aclresult; @@ -1961,7 +1961,7 @@ has_table_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid tableoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -2043,8 +2043,8 @@ Datum has_sequence_privilege_name_name(PG_FUNCTION_ARGS) { Name rolename = PG_GETARG_NAME(0); - text *sequencename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *sequencename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid sequenceoid; AclMode mode; @@ -2073,8 +2073,8 @@ has_sequence_privilege_name_name(PG_FUNCTION_ARGS) Datum has_sequence_privilege_name(PG_FUNCTION_ARGS) { - text *sequencename = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *sequencename = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid sequenceoid; AclMode mode; @@ -2104,7 +2104,7 @@ has_sequence_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid sequenceoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -2136,7 +2136,7 @@ Datum has_sequence_privilege_id(PG_FUNCTION_ARGS) { Oid sequenceoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -2167,8 +2167,8 @@ Datum has_sequence_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *sequencename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *sequencename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid sequenceoid; AclMode mode; AclResult aclresult; @@ -2196,7 +2196,7 @@ has_sequence_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid sequenceoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; char relkind; @@ -2254,8 +2254,8 @@ Datum has_any_column_privilege_name_name(PG_FUNCTION_ARGS) { Name rolename = PG_GETARG_NAME(0); - text *tablename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *tablename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid tableoid; AclMode mode; @@ -2283,8 +2283,8 @@ has_any_column_privilege_name_name(PG_FUNCTION_ARGS) Datum has_any_column_privilege_name(PG_FUNCTION_ARGS) { - text *tablename = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *tablename = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid tableoid; AclMode mode; @@ -2313,7 +2313,7 @@ has_any_column_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid tableoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -2343,7 +2343,7 @@ Datum has_any_column_privilege_id(PG_FUNCTION_ARGS) { Oid tableoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -2372,8 +2372,8 @@ Datum has_any_column_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *tablename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *tablename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid tableoid; AclMode mode; AclResult aclresult; @@ -2400,7 +2400,7 @@ has_any_column_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid tableoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -2494,9 +2494,9 @@ Datum has_column_privilege_name_name_name(PG_FUNCTION_ARGS) { Name rolename = PG_GETARG_NAME(0); - text *tablename = PG_GETARG_TEXT_P(1); - text *column = PG_GETARG_TEXT_P(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *tablename = PG_GETARG_TEXT_PP(1); + text *column = PG_GETARG_TEXT_PP(2); + text *priv_type_text = PG_GETARG_TEXT_PP(3); Oid roleid; Oid tableoid; AttrNumber colattnum; @@ -2523,9 +2523,9 @@ Datum has_column_privilege_name_name_attnum(PG_FUNCTION_ARGS) { Name rolename = PG_GETARG_NAME(0); - text *tablename = PG_GETARG_TEXT_P(1); + text *tablename = PG_GETARG_TEXT_PP(1); AttrNumber colattnum = PG_GETARG_INT16(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *priv_type_text = PG_GETARG_TEXT_PP(3); Oid roleid; Oid tableoid; AclMode mode; @@ -2551,8 +2551,8 @@ has_column_privilege_name_id_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid tableoid = PG_GETARG_OID(1); - text *column = PG_GETARG_TEXT_P(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *column = PG_GETARG_TEXT_PP(2); + text *priv_type_text = PG_GETARG_TEXT_PP(3); Oid roleid; AttrNumber colattnum; AclMode mode; @@ -2579,7 +2579,7 @@ has_column_privilege_name_id_attnum(PG_FUNCTION_ARGS) Name username = PG_GETARG_NAME(0); Oid tableoid = PG_GETARG_OID(1); AttrNumber colattnum = PG_GETARG_INT16(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *priv_type_text = PG_GETARG_TEXT_PP(3); Oid roleid; AclMode mode; int privresult; @@ -2602,9 +2602,9 @@ Datum has_column_privilege_id_name_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *tablename = PG_GETARG_TEXT_P(1); - text *column = PG_GETARG_TEXT_P(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *tablename = PG_GETARG_TEXT_PP(1); + text *column = PG_GETARG_TEXT_PP(2); + text *priv_type_text = PG_GETARG_TEXT_PP(3); Oid tableoid; AttrNumber colattnum; AclMode mode; @@ -2629,9 +2629,9 @@ Datum has_column_privilege_id_name_attnum(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *tablename = PG_GETARG_TEXT_P(1); + text *tablename = PG_GETARG_TEXT_PP(1); AttrNumber colattnum = PG_GETARG_INT16(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *priv_type_text = PG_GETARG_TEXT_PP(3); Oid tableoid; AclMode mode; int privresult; @@ -2655,8 +2655,8 @@ has_column_privilege_id_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid tableoid = PG_GETARG_OID(1); - text *column = PG_GETARG_TEXT_P(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *column = PG_GETARG_TEXT_PP(2); + text *priv_type_text = PG_GETARG_TEXT_PP(3); AttrNumber colattnum; AclMode mode; int privresult; @@ -2681,7 +2681,7 @@ has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS) Oid roleid = PG_GETARG_OID(0); Oid tableoid = PG_GETARG_OID(1); AttrNumber colattnum = PG_GETARG_INT16(2); - text *priv_type_text = PG_GETARG_TEXT_P(3); + text *priv_type_text = PG_GETARG_TEXT_PP(3); AclMode mode; int privresult; @@ -2702,9 +2702,9 @@ has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS) Datum has_column_privilege_name_name(PG_FUNCTION_ARGS) { - text *tablename = PG_GETARG_TEXT_P(0); - text *column = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *tablename = PG_GETARG_TEXT_PP(0); + text *column = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid tableoid; AttrNumber colattnum; @@ -2731,9 +2731,9 @@ has_column_privilege_name_name(PG_FUNCTION_ARGS) Datum has_column_privilege_name_attnum(PG_FUNCTION_ARGS) { - text *tablename = PG_GETARG_TEXT_P(0); + text *tablename = PG_GETARG_TEXT_PP(0); AttrNumber colattnum = PG_GETARG_INT16(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid tableoid; AclMode mode; @@ -2759,8 +2759,8 @@ Datum has_column_privilege_id_name(PG_FUNCTION_ARGS) { Oid tableoid = PG_GETARG_OID(0); - text *column = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *column = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AttrNumber colattnum; AclMode mode; @@ -2787,7 +2787,7 @@ has_column_privilege_id_attnum(PG_FUNCTION_ARGS) { Oid tableoid = PG_GETARG_OID(0); AttrNumber colattnum = PG_GETARG_INT16(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; int privresult; @@ -2868,8 +2868,8 @@ Datum has_database_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *databasename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *databasename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid databaseoid; AclMode mode; @@ -2893,8 +2893,8 @@ has_database_privilege_name_name(PG_FUNCTION_ARGS) Datum has_database_privilege_name(PG_FUNCTION_ARGS) { - text *databasename = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *databasename = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid databaseoid; AclMode mode; @@ -2919,7 +2919,7 @@ has_database_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid databaseoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -2945,7 +2945,7 @@ Datum has_database_privilege_id(PG_FUNCTION_ARGS) { Oid databaseoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -2970,8 +2970,8 @@ Datum has_database_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *databasename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *databasename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid databaseoid; AclMode mode; AclResult aclresult; @@ -2994,7 +2994,7 @@ has_database_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid databaseoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -3066,8 +3066,8 @@ Datum has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *fdwname = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *fdwname = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid fdwid; AclMode mode; @@ -3091,8 +3091,8 @@ has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS) Datum has_foreign_data_wrapper_privilege_name(PG_FUNCTION_ARGS) { - text *fdwname = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *fdwname = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid fdwid; AclMode mode; @@ -3117,7 +3117,7 @@ has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid fdwid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -3140,7 +3140,7 @@ Datum has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS) { Oid fdwid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -3162,8 +3162,8 @@ Datum has_foreign_data_wrapper_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *fdwname = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *fdwname = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid fdwid; AclMode mode; AclResult aclresult; @@ -3186,7 +3186,7 @@ has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid fdwid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -3248,8 +3248,8 @@ Datum has_function_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *functionname = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *functionname = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid functionoid; AclMode mode; @@ -3273,8 +3273,8 @@ has_function_privilege_name_name(PG_FUNCTION_ARGS) Datum has_function_privilege_name(PG_FUNCTION_ARGS) { - text *functionname = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *functionname = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid functionoid; AclMode mode; @@ -3299,7 +3299,7 @@ has_function_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid functionoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -3325,7 +3325,7 @@ Datum has_function_privilege_id(PG_FUNCTION_ARGS) { Oid functionoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -3350,8 +3350,8 @@ Datum has_function_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *functionname = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *functionname = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid functionoid; AclMode mode; AclResult aclresult; @@ -3374,7 +3374,7 @@ has_function_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid functionoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -3448,8 +3448,8 @@ Datum has_language_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *languagename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *languagename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid languageoid; AclMode mode; @@ -3473,8 +3473,8 @@ has_language_privilege_name_name(PG_FUNCTION_ARGS) Datum has_language_privilege_name(PG_FUNCTION_ARGS) { - text *languagename = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *languagename = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid languageoid; AclMode mode; @@ -3499,7 +3499,7 @@ has_language_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid languageoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -3525,7 +3525,7 @@ Datum has_language_privilege_id(PG_FUNCTION_ARGS) { Oid languageoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -3550,8 +3550,8 @@ Datum has_language_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *languagename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *languagename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid languageoid; AclMode mode; AclResult aclresult; @@ -3574,7 +3574,7 @@ has_language_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid languageoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -3639,8 +3639,8 @@ Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *schemaname = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *schemaname = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid schemaoid; AclMode mode; @@ -3664,8 +3664,8 @@ has_schema_privilege_name_name(PG_FUNCTION_ARGS) Datum has_schema_privilege_name(PG_FUNCTION_ARGS) { - text *schemaname = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *schemaname = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid schemaoid; AclMode mode; @@ -3690,7 +3690,7 @@ has_schema_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid schemaoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -3716,7 +3716,7 @@ Datum has_schema_privilege_id(PG_FUNCTION_ARGS) { Oid schemaoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -3741,8 +3741,8 @@ Datum has_schema_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *schemaname = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *schemaname = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid schemaoid; AclMode mode; AclResult aclresult; @@ -3765,7 +3765,7 @@ has_schema_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid schemaoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -3832,8 +3832,8 @@ Datum has_server_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *servername = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *servername = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid serverid; AclMode mode; @@ -3857,8 +3857,8 @@ has_server_privilege_name_name(PG_FUNCTION_ARGS) Datum has_server_privilege_name(PG_FUNCTION_ARGS) { - text *servername = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *servername = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid serverid; AclMode mode; @@ -3883,7 +3883,7 @@ has_server_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid serverid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -3906,7 +3906,7 @@ Datum has_server_privilege_id(PG_FUNCTION_ARGS) { Oid serverid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -3928,8 +3928,8 @@ Datum has_server_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *servername = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *servername = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid serverid; AclMode mode; AclResult aclresult; @@ -3952,7 +3952,7 @@ has_server_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid serverid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -4014,8 +4014,8 @@ Datum has_tablespace_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *tablespacename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *tablespacename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid tablespaceoid; AclMode mode; @@ -4039,8 +4039,8 @@ has_tablespace_privilege_name_name(PG_FUNCTION_ARGS) Datum has_tablespace_privilege_name(PG_FUNCTION_ARGS) { - text *tablespacename = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *tablespacename = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid tablespaceoid; AclMode mode; @@ -4065,7 +4065,7 @@ has_tablespace_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid tablespaceoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -4088,7 +4088,7 @@ Datum has_tablespace_privilege_id(PG_FUNCTION_ARGS) { Oid tablespaceoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -4110,8 +4110,8 @@ Datum has_tablespace_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *tablespacename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *tablespacename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid tablespaceoid; AclMode mode; AclResult aclresult; @@ -4134,7 +4134,7 @@ has_tablespace_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid tablespaceoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -4195,8 +4195,8 @@ Datum has_type_privilege_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); - text *typename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *typename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid typeoid; AclMode mode; @@ -4220,8 +4220,8 @@ has_type_privilege_name_name(PG_FUNCTION_ARGS) Datum has_type_privilege_name(PG_FUNCTION_ARGS) { - text *typename = PG_GETARG_TEXT_P(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *typename = PG_GETARG_TEXT_PP(0); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid typeoid; AclMode mode; @@ -4246,7 +4246,7 @@ has_type_privilege_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid typeoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -4272,7 +4272,7 @@ Datum has_type_privilege_id(PG_FUNCTION_ARGS) { Oid typeoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -4297,8 +4297,8 @@ Datum has_type_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); - text *typename = PG_GETARG_TEXT_P(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *typename = PG_GETARG_TEXT_PP(1); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid typeoid; AclMode mode; AclResult aclresult; @@ -4321,7 +4321,7 @@ has_type_privilege_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid typeoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; @@ -4396,7 +4396,7 @@ pg_has_role_name_name(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Name rolename = PG_GETARG_NAME(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; Oid roleoid; AclMode mode; @@ -4421,7 +4421,7 @@ Datum pg_has_role_name(PG_FUNCTION_ARGS) { Name rolename = PG_GETARG_NAME(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; Oid roleoid; AclMode mode; @@ -4446,7 +4446,7 @@ pg_has_role_name_id(PG_FUNCTION_ARGS) { Name username = PG_GETARG_NAME(0); Oid roleoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleid; AclMode mode; AclResult aclresult; @@ -4469,7 +4469,7 @@ Datum pg_has_role_id(PG_FUNCTION_ARGS) { Oid roleoid = PG_GETARG_OID(0); - text *priv_type_text = PG_GETARG_TEXT_P(1); + text *priv_type_text = PG_GETARG_TEXT_PP(1); Oid roleid; AclMode mode; AclResult aclresult; @@ -4492,7 +4492,7 @@ pg_has_role_id_name(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Name rolename = PG_GETARG_NAME(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); Oid roleoid; AclMode mode; AclResult aclresult; @@ -4515,7 +4515,7 @@ pg_has_role_id_id(PG_FUNCTION_ARGS) { Oid roleid = PG_GETARG_OID(0); Oid roleoid = PG_GETARG_OID(1); - text *priv_type_text = PG_GETARG_TEXT_P(2); + text *priv_type_text = PG_GETARG_TEXT_PP(2); AclMode mode; AclResult aclresult; diff --git a/src/backend/utils/adt/char.c b/src/backend/utils/adt/char.c index f0c4d25396..1b849e8703 100644 --- a/src/backend/utils/adt/char.c +++ b/src/backend/utils/adt/char.c @@ -175,7 +175,7 @@ i4tochar(PG_FUNCTION_ARGS) Datum text_char(PG_FUNCTION_ARGS) { - text *arg1 = PG_GETARG_TEXT_P(0); + text *arg1 = PG_GETARG_TEXT_PP(0); char result; /* @@ -183,8 +183,8 @@ text_char(PG_FUNCTION_ARGS) * If the input is longer than one character, the excess data is silently * discarded. */ - if (VARSIZE(arg1) > VARHDRSZ) - result = *(VARDATA(arg1)); + if (VARSIZE_ANY_EXHDR(arg1) > 0) + result = *(VARDATA_ANY(arg1)); else result = '\0'; diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 8cdd1dc4f7..58923912eb 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -308,7 +308,7 @@ Datum pg_relation_size(PG_FUNCTION_ARGS) { Oid relOid = PG_GETARG_OID(0); - text *forkName = PG_GETARG_TEXT_P(1); + text *forkName = PG_GETARG_TEXT_PP(1); Relation rel; int64 size; diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c index 027f28eb62..8fd8ede39e 100644 --- a/src/backend/utils/adt/encode.c +++ b/src/backend/utils/adt/encode.c @@ -35,7 +35,7 @@ static const struct pg_encoding *pg_find_encoding(const char *name); Datum binary_encode(PG_FUNCTION_ARGS) { - bytea *data = PG_GETARG_BYTEA_P(0); + bytea *data = PG_GETARG_BYTEA_PP(0); Datum name = PG_GETARG_DATUM(1); text *result; char *namebuf; @@ -44,7 +44,7 @@ binary_encode(PG_FUNCTION_ARGS) res; const struct pg_encoding *enc; - datalen = VARSIZE(data) - VARHDRSZ; + datalen = VARSIZE_ANY_EXHDR(data); namebuf = TextDatumGetCString(name); @@ -54,10 +54,10 @@ binary_encode(PG_FUNCTION_ARGS) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("unrecognized encoding: \"%s\"", namebuf))); - resultlen = enc->encode_len(VARDATA(data), datalen); + resultlen = enc->encode_len(VARDATA_ANY(data), datalen); result = palloc(VARHDRSZ + resultlen); - res = enc->encode(VARDATA(data), datalen, VARDATA(result)); + res = enc->encode(VARDATA_ANY(data), datalen, VARDATA(result)); /* Make this FATAL 'cause we've trodden on memory ... */ if (res > resultlen) @@ -71,7 +71,7 @@ binary_encode(PG_FUNCTION_ARGS) Datum binary_decode(PG_FUNCTION_ARGS) { - text *data = PG_GETARG_TEXT_P(0); + text *data = PG_GETARG_TEXT_PP(0); Datum name = PG_GETARG_DATUM(1); bytea *result; char *namebuf; @@ -80,7 +80,7 @@ binary_decode(PG_FUNCTION_ARGS) res; const struct pg_encoding *enc; - datalen = VARSIZE(data) - VARHDRSZ; + datalen = VARSIZE_ANY_EXHDR(data); namebuf = TextDatumGetCString(name); @@ -90,10 +90,10 @@ binary_decode(PG_FUNCTION_ARGS) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("unrecognized encoding: \"%s\"", namebuf))); - resultlen = enc->decode_len(VARDATA(data), datalen); + resultlen = enc->decode_len(VARDATA_ANY(data), datalen); result = palloc(VARHDRSZ + resultlen); - res = enc->decode(VARDATA(data), datalen, VARDATA(result)); + res = enc->decode(VARDATA_ANY(data), datalen, VARDATA(result)); /* Make this FATAL 'cause we've trodden on memory ... */ if (res > resultlen) diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index e552c8d20b..c16bfbca93 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -3380,13 +3380,13 @@ Datum timestamp_to_char(PG_FUNCTION_ARGS) { Timestamp dt = PG_GETARG_TIMESTAMP(0); - text *fmt = PG_GETARG_TEXT_P(1), + text *fmt = PG_GETARG_TEXT_PP(1), *res; TmToChar tmtc; struct pg_tm *tm; int thisdate; - if ((VARSIZE(fmt) - VARHDRSZ) <= 0 || TIMESTAMP_NOT_FINITE(dt)) + if (VARSIZE_ANY_EXHDR(fmt) <= 0 || TIMESTAMP_NOT_FINITE(dt)) PG_RETURN_NULL(); ZERO_tmtc(&tmtc); @@ -3411,14 +3411,14 @@ Datum timestamptz_to_char(PG_FUNCTION_ARGS) { TimestampTz dt = PG_GETARG_TIMESTAMP(0); - text *fmt = PG_GETARG_TEXT_P(1), + text *fmt = PG_GETARG_TEXT_PP(1), *res; TmToChar tmtc; int tz; struct pg_tm *tm; int thisdate; - if ((VARSIZE(fmt) - VARHDRSZ) <= 0 || TIMESTAMP_NOT_FINITE(dt)) + if (VARSIZE_ANY_EXHDR(fmt) <= 0 || TIMESTAMP_NOT_FINITE(dt)) PG_RETURN_NULL(); ZERO_tmtc(&tmtc); @@ -3448,12 +3448,12 @@ Datum interval_to_char(PG_FUNCTION_ARGS) { Interval *it = PG_GETARG_INTERVAL_P(0); - text *fmt = PG_GETARG_TEXT_P(1), + text *fmt = PG_GETARG_TEXT_PP(1), *res; TmToChar tmtc; struct pg_tm *tm; - if ((VARSIZE(fmt) - VARHDRSZ) <= 0) + if (VARSIZE_ANY_EXHDR(fmt) <= 0) PG_RETURN_NULL(); ZERO_tmtc(&tmtc); @@ -3481,8 +3481,8 @@ interval_to_char(PG_FUNCTION_ARGS) Datum to_timestamp(PG_FUNCTION_ARGS) { - text *date_txt = PG_GETARG_TEXT_P(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *date_txt = PG_GETARG_TEXT_PP(0); + text *fmt = PG_GETARG_TEXT_PP(1); Timestamp result; int tz; struct pg_tm tm; @@ -3508,8 +3508,8 @@ to_timestamp(PG_FUNCTION_ARGS) Datum to_date(PG_FUNCTION_ARGS) { - text *date_txt = PG_GETARG_TEXT_P(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *date_txt = PG_GETARG_TEXT_PP(0); + text *fmt = PG_GETARG_TEXT_PP(1); DateADT result; struct pg_tm tm; fsec_t fsec; @@ -5038,8 +5038,8 @@ do { \ Datum numeric_to_number(PG_FUNCTION_ARGS) { - text *value = PG_GETARG_TEXT_P(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *value = PG_GETARG_TEXT_PP(0); + text *fmt = PG_GETARG_TEXT_PP(1); NUMDesc Num; Datum result; FormatNode *format; @@ -5049,7 +5049,7 @@ numeric_to_number(PG_FUNCTION_ARGS) int scale, precision; - len = VARSIZE(fmt) - VARHDRSZ; + len = VARSIZE_ANY_EXHDR(fmt); if (len <= 0 || len >= INT_MAX / NUM_MAX_ITEM_SIZ) PG_RETURN_NULL(); @@ -5058,8 +5058,8 @@ numeric_to_number(PG_FUNCTION_ARGS) numstr = (char *) palloc((len * NUM_MAX_ITEM_SIZ) + 1); - NUM_processor(format, &Num, VARDATA(value), numstr, - VARSIZE(value) - VARHDRSZ, 0, 0, false, PG_GET_COLLATION()); + NUM_processor(format, &Num, VARDATA_ANY(value), numstr, + VARSIZE_ANY_EXHDR(value), 0, 0, false, PG_GET_COLLATION()); scale = Num.post; precision = Num.pre + Num.multi + scale; @@ -5100,7 +5100,7 @@ Datum numeric_to_char(PG_FUNCTION_ARGS) { Numeric value = PG_GETARG_NUMERIC(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *fmt = PG_GETARG_TEXT_PP(1); NUMDesc Num; FormatNode *format; text *result; @@ -5224,7 +5224,7 @@ Datum int4_to_char(PG_FUNCTION_ARGS) { int32 value = PG_GETARG_INT32(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *fmt = PG_GETARG_TEXT_PP(1); NUMDesc Num; FormatNode *format; text *result; @@ -5319,7 +5319,7 @@ Datum int8_to_char(PG_FUNCTION_ARGS) { int64 value = PG_GETARG_INT64(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *fmt = PG_GETARG_TEXT_PP(1); NUMDesc Num; FormatNode *format; text *result; @@ -5429,7 +5429,7 @@ Datum float4_to_char(PG_FUNCTION_ARGS) { float4 value = PG_GETARG_FLOAT4(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *fmt = PG_GETARG_TEXT_PP(1); NUMDesc Num; FormatNode *format; text *result; @@ -5535,7 +5535,7 @@ Datum float8_to_char(PG_FUNCTION_ARGS) { float8 value = PG_GETARG_FLOAT8(0); - text *fmt = PG_GETARG_TEXT_P(1); + text *fmt = PG_GETARG_TEXT_PP(1); NUMDesc Num; FormatNode *format; text *result; diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c index 1a127d9258..2147936dd8 100644 --- a/src/backend/utils/adt/genfile.c +++ b/src/backend/utils/adt/genfile.c @@ -187,7 +187,7 @@ read_text_file(const char *filename, int64 seek_offset, int64 bytes_to_read, Datum pg_read_file(PG_FUNCTION_ARGS) { - text *filename_t = PG_GETARG_TEXT_P(0); + text *filename_t = PG_GETARG_TEXT_PP(0); int64 seek_offset = 0; int64 bytes_to_read = -1; bool missing_ok = false; @@ -228,7 +228,7 @@ pg_read_file(PG_FUNCTION_ARGS) Datum pg_read_binary_file(PG_FUNCTION_ARGS) { - text *filename_t = PG_GETARG_TEXT_P(0); + text *filename_t = PG_GETARG_TEXT_PP(0); int64 seek_offset = 0; int64 bytes_to_read = -1; bool missing_ok = false; @@ -303,7 +303,7 @@ pg_read_binary_file_all(PG_FUNCTION_ARGS) Datum pg_stat_file(PG_FUNCTION_ARGS) { - text *filename_t = PG_GETARG_TEXT_P(0); + text *filename_t = PG_GETARG_TEXT_PP(0); char *filename; struct stat fst; Datum values[6]; @@ -421,7 +421,7 @@ pg_ls_dir(PG_FUNCTION_ARGS) oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); fctx = palloc(sizeof(directory_fctx)); - fctx->location = convert_and_check_filename(PG_GETARG_TEXT_P(0)); + fctx->location = convert_and_check_filename(PG_GETARG_TEXT_PP(0)); fctx->include_dot_dirs = include_dot_dirs; fctx->dirdesc = AllocateDir(fctx->location); diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 0ed6a10a44..9fb0e480bf 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -299,8 +299,8 @@ json_recv(PG_FUNCTION_ARGS) JsonLexContext * makeJsonLexContext(text *json, bool need_escapes) { - return makeJsonLexContextCstringLen(VARDATA(json), - VARSIZE(json) - VARHDRSZ, + return makeJsonLexContextCstringLen(VARDATA_ANY(json), + VARSIZE_ANY_EXHDR(json), need_escapes); } @@ -1570,7 +1570,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result, break; case JSONTYPE_CAST: /* outfuncoid refers to a cast function, not an output function */ - jsontext = DatumGetTextP(OidFunctionCall1(outfuncoid, val)); + jsontext = DatumGetTextPP(OidFunctionCall1(outfuncoid, val)); outputstr = text_to_cstring(jsontext); appendStringInfoString(result, outputstr); pfree(outputstr); @@ -2492,7 +2492,7 @@ json_typeof(PG_FUNCTION_ARGS) JsonTokenType tok; char *type; - json = PG_GETARG_TEXT_P(0); + json = PG_GETARG_TEXT_PP(0); lex = makeJsonLexContext(json, false); /* Lex exactly one token from the input and check its type. */ diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c index 5b6178badf..164f57ef77 100644 --- a/src/backend/utils/adt/jsonb.c +++ b/src/backend/utils/adt/jsonb.c @@ -857,7 +857,7 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result, /* parse the json right into the existing result object */ JsonLexContext *lex; JsonSemAction sem; - text *json = DatumGetTextP(val); + text *json = DatumGetTextPP(val); lex = makeJsonLexContext(json, true); diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 9b46f8e835..bf2c91f02e 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -371,7 +371,7 @@ json_object_keys(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); JsonLexContext *lex = makeJsonLexContext(json, true); JsonSemAction *sem; MemoryContext oldcontext; @@ -482,7 +482,7 @@ okeys_scalar(void *state, char *token, JsonTokenType tokentype) Datum json_object_field(PG_FUNCTION_ARGS) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); text *fname = PG_GETARG_TEXT_PP(1); char *fnamestr = text_to_cstring(fname); text *result; @@ -518,7 +518,7 @@ jsonb_object_field(PG_FUNCTION_ARGS) Datum json_object_field_text(PG_FUNCTION_ARGS) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); text *fname = PG_GETARG_TEXT_PP(1); char *fnamestr = text_to_cstring(fname); text *result; @@ -585,7 +585,7 @@ jsonb_object_field_text(PG_FUNCTION_ARGS) Datum json_array_element(PG_FUNCTION_ARGS) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); int element = PG_GETARG_INT32(1); text *result; @@ -628,7 +628,7 @@ jsonb_array_element(PG_FUNCTION_ARGS) Datum json_array_element_text(PG_FUNCTION_ARGS) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); int element = PG_GETARG_INT32(1); text *result; @@ -717,7 +717,7 @@ json_extract_path_text(PG_FUNCTION_ARGS) static Datum get_path_all(FunctionCallInfo fcinfo, bool as_text) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); ArrayType *path = PG_GETARG_ARRAYTYPE_P(1); text *result; Datum *pathtext; @@ -1338,7 +1338,7 @@ get_jsonb_path_all(FunctionCallInfo fcinfo, bool as_text) Datum json_array_length(PG_FUNCTION_ARGS) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); AlenState *state; JsonLexContext *lex; JsonSemAction *sem; @@ -1592,7 +1592,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text) static Datum each_worker(FunctionCallInfo fcinfo, bool as_text) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); JsonLexContext *lex; JsonSemAction *sem; ReturnSetInfo *rsi; @@ -1906,7 +1906,7 @@ json_array_elements_text(PG_FUNCTION_ARGS) static Datum elements_worker(FunctionCallInfo fcinfo, const char *funcname, bool as_text) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); /* elements only needs escaped strings when as_text */ JsonLexContext *lex = makeJsonLexContext(json, as_text); @@ -2177,7 +2177,7 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname, if (jtype == JSONOID) { /* just get the text */ - json = PG_GETARG_TEXT_P(json_arg_num); + json = PG_GETARG_TEXT_PP(json_arg_num); json_hash = get_json_object_as_hash(json, funcname); @@ -2767,7 +2767,7 @@ populate_recordset_worker(FunctionCallInfo fcinfo, const char *funcname, if (jtype == JSONOID) { - text *json = PG_GETARG_TEXT_P(json_arg_num); + text *json = PG_GETARG_TEXT_PP(json_arg_num); JsonLexContext *lex; JsonSemAction *sem; @@ -3193,7 +3193,7 @@ sn_scalar(void *state, char *token, JsonTokenType tokentype) Datum json_strip_nulls(PG_FUNCTION_ARGS) { - text *json = PG_GETARG_TEXT_P(0); + text *json = PG_GETARG_TEXT_PP(0); StripnullState *state; JsonLexContext *lex; JsonSemAction *sem; diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c index 91fe109867..8d9d285fb5 100644 --- a/src/backend/utils/adt/like.c +++ b/src/backend/utils/adt/like.c @@ -175,14 +175,14 @@ Generic_Text_IC_like(text *str, text *pat, Oid collation) if (pg_database_encoding_max_length() > 1) { /* lower's result is never packed, so OK to use old macros here */ - pat = DatumGetTextP(DirectFunctionCall1Coll(lower, collation, - PointerGetDatum(pat))); - p = VARDATA(pat); - plen = (VARSIZE(pat) - VARHDRSZ); - str = DatumGetTextP(DirectFunctionCall1Coll(lower, collation, - PointerGetDatum(str))); - s = VARDATA(str); - slen = (VARSIZE(str) - VARHDRSZ); + pat = DatumGetTextPP(DirectFunctionCall1Coll(lower, collation, + PointerGetDatum(pat))); + p = VARDATA_ANY(pat); + plen = VARSIZE_ANY_EXHDR(pat); + str = DatumGetTextPP(DirectFunctionCall1Coll(lower, collation, + PointerGetDatum(str))); + s = VARDATA_ANY(str); + slen = VARSIZE_ANY_EXHDR(str); if (GetDatabaseEncoding() == PG_UTF8) return UTF8_MatchText(s, slen, p, plen, 0, true); else @@ -365,8 +365,8 @@ nameiclike(PG_FUNCTION_ARGS) bool result; text *strtext; - strtext = DatumGetTextP(DirectFunctionCall1(name_text, - NameGetDatum(str))); + strtext = DatumGetTextPP(DirectFunctionCall1(name_text, + NameGetDatum(str))); result = (Generic_Text_IC_like(strtext, pat, PG_GET_COLLATION()) == LIKE_TRUE); PG_RETURN_BOOL(result); @@ -380,8 +380,8 @@ nameicnlike(PG_FUNCTION_ARGS) bool result; text *strtext; - strtext = DatumGetTextP(DirectFunctionCall1(name_text, - NameGetDatum(str))); + strtext = DatumGetTextPP(DirectFunctionCall1(name_text, + NameGetDatum(str))); result = (Generic_Text_IC_like(strtext, pat, PG_GET_COLLATION()) != LIKE_TRUE); PG_RETURN_BOOL(result); diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 781c713f81..6cce0f292c 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -3601,7 +3601,7 @@ numeric_avg_serialize(PG_FUNCTION_ARGS) temp = DirectFunctionCall1(numeric_send, NumericGetDatum(make_result(&tmp_var))); - sumX = DatumGetByteaP(temp); + sumX = DatumGetByteaPP(temp); free_var(&tmp_var); pq_begintypsend(&buf); @@ -3610,7 +3610,7 @@ numeric_avg_serialize(PG_FUNCTION_ARGS) pq_sendint64(&buf, state->N); /* sumX */ - pq_sendbytes(&buf, VARDATA(sumX), VARSIZE(sumX) - VARHDRSZ); + pq_sendbytes(&buf, VARDATA_ANY(sumX), VARSIZE_ANY_EXHDR(sumX)); /* maxScale */ pq_sendint(&buf, state->maxScale, 4); @@ -3643,14 +3643,15 @@ numeric_avg_deserialize(PG_FUNCTION_ARGS) if (!AggCheckCallContext(fcinfo, NULL)) elog(ERROR, "aggregate function called in non-aggregate context"); - sstate = PG_GETARG_BYTEA_P(0); + sstate = PG_GETARG_BYTEA_PP(0); /* * Copy the bytea into a StringInfo so that we can "receive" it using the * standard recv-function infrastructure. */ initStringInfo(&buf); - appendBinaryStringInfo(&buf, VARDATA(sstate), VARSIZE(sstate) - VARHDRSZ); + appendBinaryStringInfo(&buf, + VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate)); result = makeNumericAggStateCurrentContext(false); @@ -3713,12 +3714,12 @@ numeric_serialize(PG_FUNCTION_ARGS) accum_sum_final(&state->sumX, &tmp_var); temp = DirectFunctionCall1(numeric_send, NumericGetDatum(make_result(&tmp_var))); - sumX = DatumGetByteaP(temp); + sumX = DatumGetByteaPP(temp); accum_sum_final(&state->sumX2, &tmp_var); temp = DirectFunctionCall1(numeric_send, NumericGetDatum(make_result(&tmp_var))); - sumX2 = DatumGetByteaP(temp); + sumX2 = DatumGetByteaPP(temp); free_var(&tmp_var); @@ -3728,10 +3729,10 @@ numeric_serialize(PG_FUNCTION_ARGS) pq_sendint64(&buf, state->N); /* sumX */ - pq_sendbytes(&buf, VARDATA(sumX), VARSIZE(sumX) - VARHDRSZ); + pq_sendbytes(&buf, VARDATA_ANY(sumX), VARSIZE_ANY_EXHDR(sumX)); /* sumX2 */ - pq_sendbytes(&buf, VARDATA(sumX2), VARSIZE(sumX2) - VARHDRSZ); + pq_sendbytes(&buf, VARDATA_ANY(sumX2), VARSIZE_ANY_EXHDR(sumX2)); /* maxScale */ pq_sendint(&buf, state->maxScale, 4); @@ -3765,14 +3766,15 @@ numeric_deserialize(PG_FUNCTION_ARGS) if (!AggCheckCallContext(fcinfo, NULL)) elog(ERROR, "aggregate function called in non-aggregate context"); - sstate = PG_GETARG_BYTEA_P(0); + sstate = PG_GETARG_BYTEA_PP(0); /* * Copy the bytea into a StringInfo so that we can "receive" it using the * standard recv-function infrastructure. */ initStringInfo(&buf); - appendBinaryStringInfo(&buf, VARDATA(sstate), VARSIZE(sstate) - VARHDRSZ); + appendBinaryStringInfo(&buf, + VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate)); result = makeNumericAggStateCurrentContext(false); @@ -4114,7 +4116,7 @@ numeric_poly_serialize(PG_FUNCTION_ARGS) #endif temp = DirectFunctionCall1(numeric_send, NumericGetDatum(make_result(&num))); - sumX = DatumGetByteaP(temp); + sumX = DatumGetByteaPP(temp); #ifdef HAVE_INT128 int128_to_numericvar(state->sumX2, &num); @@ -4123,7 +4125,7 @@ numeric_poly_serialize(PG_FUNCTION_ARGS) #endif temp = DirectFunctionCall1(numeric_send, NumericGetDatum(make_result(&num))); - sumX2 = DatumGetByteaP(temp); + sumX2 = DatumGetByteaPP(temp); free_var(&num); } @@ -4134,10 +4136,10 @@ numeric_poly_serialize(PG_FUNCTION_ARGS) pq_sendint64(&buf, state->N); /* sumX */ - pq_sendbytes(&buf, VARDATA(sumX), VARSIZE(sumX) - VARHDRSZ); + pq_sendbytes(&buf, VARDATA_ANY(sumX), VARSIZE_ANY_EXHDR(sumX)); /* sumX2 */ - pq_sendbytes(&buf, VARDATA(sumX2), VARSIZE(sumX2) - VARHDRSZ); + pq_sendbytes(&buf, VARDATA_ANY(sumX2), VARSIZE_ANY_EXHDR(sumX2)); result = pq_endtypsend(&buf); @@ -4163,14 +4165,15 @@ numeric_poly_deserialize(PG_FUNCTION_ARGS) if (!AggCheckCallContext(fcinfo, NULL)) elog(ERROR, "aggregate function called in non-aggregate context"); - sstate = PG_GETARG_BYTEA_P(0); + sstate = PG_GETARG_BYTEA_PP(0); /* * Copy the bytea into a StringInfo so that we can "receive" it using the * standard recv-function infrastructure. */ initStringInfo(&buf); - appendBinaryStringInfo(&buf, VARDATA(sstate), VARSIZE(sstate) - VARHDRSZ); + appendBinaryStringInfo(&buf, + VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate)); result = makePolyNumAggStateCurrentContext(false); @@ -4338,7 +4341,7 @@ int8_avg_serialize(PG_FUNCTION_ARGS) #endif temp = DirectFunctionCall1(numeric_send, NumericGetDatum(make_result(&num))); - sumX = DatumGetByteaP(temp); + sumX = DatumGetByteaPP(temp); free_var(&num); } @@ -4349,7 +4352,7 @@ int8_avg_serialize(PG_FUNCTION_ARGS) pq_sendint64(&buf, state->N); /* sumX */ - pq_sendbytes(&buf, VARDATA(sumX), VARSIZE(sumX) - VARHDRSZ); + pq_sendbytes(&buf, VARDATA_ANY(sumX), VARSIZE_ANY_EXHDR(sumX)); result = pq_endtypsend(&buf); @@ -4372,14 +4375,15 @@ int8_avg_deserialize(PG_FUNCTION_ARGS) if (!AggCheckCallContext(fcinfo, NULL)) elog(ERROR, "aggregate function called in non-aggregate context"); - sstate = PG_GETARG_BYTEA_P(0); + sstate = PG_GETARG_BYTEA_PP(0); /* * Copy the bytea into a StringInfo so that we can "receive" it using the * standard recv-function infrastructure. */ initStringInfo(&buf); - appendBinaryStringInfo(&buf, VARDATA(sstate), VARSIZE(sstate) - VARHDRSZ); + appendBinaryStringInfo(&buf, + VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate)); result = makePolyNumAggStateCurrentContext(false); diff --git a/src/backend/utils/adt/quote.c b/src/backend/utils/adt/quote.c index 549c503031..43e5bb7962 100644 --- a/src/backend/utils/adt/quote.c +++ b/src/backend/utils/adt/quote.c @@ -76,17 +76,17 @@ quote_literal_internal(char *dst, const char *src, size_t len) Datum quote_literal(PG_FUNCTION_ARGS) { - text *t = PG_GETARG_TEXT_P(0); + text *t = PG_GETARG_TEXT_PP(0); text *result; char *cp1; char *cp2; int len; - len = VARSIZE(t) - VARHDRSZ; + len = VARSIZE_ANY_EXHDR(t); /* We make a worst-case result area; wasting a little space is OK */ result = (text *) palloc(len * 2 + 3 + VARHDRSZ); - cp1 = VARDATA(t); + cp1 = VARDATA_ANY(t); cp2 = VARDATA(result); SET_VARSIZE(result, VARHDRSZ + quote_literal_internal(cp2, cp1, len)); diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c index e518523a70..304345b904 100644 --- a/src/backend/utils/adt/rangetypes.c +++ b/src/backend/utils/adt/rangetypes.c @@ -404,7 +404,7 @@ range_constructor3(PG_FUNCTION_ARGS) (errcode(ERRCODE_DATA_EXCEPTION), errmsg("range constructor flags argument must not be null"))); - flags = range_parse_flags(text_to_cstring(PG_GETARG_TEXT_P(2))); + flags = range_parse_flags(text_to_cstring(PG_GETARG_TEXT_PP(2))); lower.val = PG_ARGISNULL(0) ? (Datum) 0 : arg1; lower.infinite = PG_ARGISNULL(0); diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index fa920c0d8c..702924a958 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -1810,7 +1810,7 @@ regnamespacesend(PG_FUNCTION_ARGS) Datum text_regclass(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); Oid result; RangeVar *rv; diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 3c697f3c0d..5c823250bc 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -647,7 +647,7 @@ Datum pg_get_viewdef_name(PG_FUNCTION_ARGS) { /* By qualified name */ - text *viewname = PG_GETARG_TEXT_P(0); + text *viewname = PG_GETARG_TEXT_PP(0); int prettyFlags; RangeVar *viewrel; Oid viewoid; @@ -672,7 +672,7 @@ Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS) { /* By qualified name */ - text *viewname = PG_GETARG_TEXT_P(0); + text *viewname = PG_GETARG_TEXT_PP(0); bool pretty = PG_GETARG_BOOL(1); int prettyFlags; RangeVar *viewrel; @@ -1034,7 +1034,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) tgrel->rd_att, &isnull); if (isnull) elog(ERROR, "tgargs is null for trigger %u", trigid); - p = (char *) VARDATA(DatumGetByteaP(value)); + p = (char *) VARDATA_ANY(DatumGetByteaPP(value)); for (i = 0; i < trigrec->tgnargs; i++) { if (i > 0) @@ -2034,7 +2034,7 @@ decompile_column_index_array(Datum column_index_array, Oid relId, Datum pg_get_expr(PG_FUNCTION_ARGS) { - text *expr = PG_GETARG_TEXT_P(0); + text *expr = PG_GETARG_TEXT_PP(0); Oid relid = PG_GETARG_OID(1); int prettyFlags; char *relname; @@ -2064,7 +2064,7 @@ pg_get_expr(PG_FUNCTION_ARGS) Datum pg_get_expr_ext(PG_FUNCTION_ARGS) { - text *expr = PG_GETARG_TEXT_P(0); + text *expr = PG_GETARG_TEXT_PP(0); Oid relid = PG_GETARG_OID(1); bool pretty = PG_GETARG_BOOL(2); int prettyFlags; @@ -2162,7 +2162,7 @@ pg_get_userbyid(PG_FUNCTION_ARGS) Datum pg_get_serial_sequence(PG_FUNCTION_ARGS) { - text *tablename = PG_GETARG_TEXT_P(0); + text *tablename = PG_GETARG_TEXT_PP(0); text *columnname = PG_GETARG_TEXT_PP(1); RangeVar *tablerv; Oid tableOid; diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index a04fd7bc90..5f28a1a7c5 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -5342,13 +5342,12 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation, } else { - bytea *bstr = DatumGetByteaP(patt_const->constvalue); + bytea *bstr = DatumGetByteaPP(patt_const->constvalue); - pattlen = VARSIZE(bstr) - VARHDRSZ; + pattlen = VARSIZE_ANY_EXHDR(bstr); patt = (char *) palloc(pattlen); - memcpy(patt, VARDATA(bstr), pattlen); - if ((Pointer) bstr != DatumGetPointer(patt_const->constvalue)) - pfree(bstr); + memcpy(patt, VARDATA_ANY(bstr), pattlen); + Assert((Pointer) bstr == DatumGetPointer(patt_const->constvalue)); } match = palloc(pattlen + 1); @@ -5858,13 +5857,12 @@ make_greater_string(const Const *str_const, FmgrInfo *ltproc, Oid collation) } else if (datatype == BYTEAOID) { - bytea *bstr = DatumGetByteaP(str_const->constvalue); + bytea *bstr = DatumGetByteaPP(str_const->constvalue); - len = VARSIZE(bstr) - VARHDRSZ; + len = VARSIZE_ANY_EXHDR(bstr); workstr = (char *) palloc(len); - memcpy(workstr, VARDATA(bstr), len); - if ((Pointer) bstr != DatumGetPointer(str_const->constvalue)) - pfree(bstr); + memcpy(workstr, VARDATA_ANY(bstr), len); + Assert((Pointer) bstr == DatumGetPointer(str_const->constvalue)); cmpstr = str_const->constvalue; } else diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c index a3b372f22a..49a5a157b9 100644 --- a/src/backend/utils/adt/tid.c +++ b/src/backend/utils/adt/tid.c @@ -368,7 +368,7 @@ currtid_byreloid(PG_FUNCTION_ARGS) Datum currtid_byrelname(PG_FUNCTION_ARGS) { - text *relname = PG_GETARG_TEXT_P(0); + text *relname = PG_GETARG_TEXT_PP(0); ItemPointer tid = PG_GETARG_ITEMPOINTER(1); ItemPointer result; RangeVar *relrv; diff --git a/src/backend/utils/adt/tsquery_rewrite.c b/src/backend/utils/adt/tsquery_rewrite.c index 266a82d634..1bd3deabd5 100644 --- a/src/backend/utils/adt/tsquery_rewrite.c +++ b/src/backend/utils/adt/tsquery_rewrite.c @@ -280,7 +280,7 @@ Datum tsquery_rewrite_query(PG_FUNCTION_ARGS) { TSQuery query = PG_GETARG_TSQUERY_COPY(0); - text *in = PG_GETARG_TEXT_P(1); + text *in = PG_GETARG_TEXT_PP(1); TSQuery rewrited = query; MemoryContext outercontext = CurrentMemoryContext; MemoryContext oldcontext; diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index 3dab84a887..c694637c8f 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -557,8 +557,8 @@ tsvector_delete_str(PG_FUNCTION_ARGS) { TSVector tsin = PG_GETARG_TSVECTOR(0), tsout; - text *tlexeme = PG_GETARG_TEXT_P(1); - char *lexeme = VARDATA(tlexeme); + text *tlexeme = PG_GETARG_TEXT_PP(1); + char *lexeme = VARDATA_ANY(tlexeme); int lexeme_len = VARSIZE_ANY_EXHDR(tlexeme), skip_index; @@ -2320,8 +2320,8 @@ ts_stat_sql(MemoryContext persistentContext, text *txt, text *ws) { char *buf; - buf = VARDATA(ws); - while (buf - VARDATA(ws) < VARSIZE(ws) - VARHDRSZ) + buf = VARDATA_ANY(ws); + while (buf - VARDATA_ANY(ws) < VARSIZE_ANY_EXHDR(ws)) { if (pg_mblen(buf) == 1) { @@ -2384,7 +2384,7 @@ ts_stat1(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { TSVectorStat *stat; - text *txt = PG_GETARG_TEXT_P(0); + text *txt = PG_GETARG_TEXT_PP(0); funcctx = SRF_FIRSTCALL_INIT(); SPI_connect(); @@ -2409,8 +2409,8 @@ ts_stat2(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { TSVectorStat *stat; - text *txt = PG_GETARG_TEXT_P(0); - text *ws = PG_GETARG_TEXT_P(1); + text *txt = PG_GETARG_TEXT_PP(0); + text *ws = PG_GETARG_TEXT_PP(1); funcctx = SRF_FIRSTCALL_INIT(); SPI_connect(); @@ -2570,9 +2570,9 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column) if (isnull) continue; - txt = DatumGetTextP(datum); + txt = DatumGetTextPP(datum); - parsetext(cfgId, &prs, VARDATA(txt), VARSIZE(txt) - VARHDRSZ); + parsetext(cfgId, &prs, VARDATA_ANY(txt), VARSIZE_ANY_EXHDR(txt)); if (txt != (text *) DatumGetPointer(datum)) pfree(txt); diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 28b5745ba8..cd036afc00 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -2662,7 +2662,7 @@ bytea_catenate(bytea *t1, bytea *t2) } #define PG_STR_GET_BYTEA(str_) \ - DatumGetByteaP(DirectFunctionCall1(byteain, CStringGetDatum(str_))) + DatumGetByteaPP(DirectFunctionCall1(byteain, CStringGetDatum(str_))) /* * bytea_substr() @@ -2934,13 +2934,12 @@ byteaGetBit(PG_FUNCTION_ARGS) Datum byteaSetByte(PG_FUNCTION_ARGS) { - bytea *v = PG_GETARG_BYTEA_P(0); + bytea *res = PG_GETARG_BYTEA_P_COPY(0); int32 n = PG_GETARG_INT32(1); int32 newByte = PG_GETARG_INT32(2); int len; - bytea *res; - len = VARSIZE(v) - VARHDRSZ; + len = VARSIZE(res) - VARHDRSZ; if (n < 0 || n >= len) ereport(ERROR, @@ -2948,12 +2947,6 @@ byteaSetByte(PG_FUNCTION_ARGS) errmsg("index %d out of valid range, 0..%d", n, len - 1))); - /* - * Make a copy of the original varlena. - */ - res = (bytea *) palloc(VARSIZE(v)); - memcpy((char *) res, (char *) v, VARSIZE(v)); - /* * Now set the byte. */ @@ -2973,17 +2966,16 @@ byteaSetByte(PG_FUNCTION_ARGS) Datum byteaSetBit(PG_FUNCTION_ARGS) { - bytea *v = PG_GETARG_BYTEA_P(0); + bytea *res = PG_GETARG_BYTEA_P_COPY(0); int32 n = PG_GETARG_INT32(1); int32 newBit = PG_GETARG_INT32(2); - bytea *res; int len; int oldByte, newByte; int byteNo, bitNo; - len = VARSIZE(v) - VARHDRSZ; + len = VARSIZE(res) - VARHDRSZ; if (n < 0 || n >= len * 8) ereport(ERROR, @@ -3002,12 +2994,6 @@ byteaSetBit(PG_FUNCTION_ARGS) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("new bit must be 0 or 1"))); - /* - * Make a copy of the original varlena. - */ - res = (bytea *) palloc(VARSIZE(v)); - memcpy((char *) res, (char *) v, VARSIZE(v)); - /* * Update the byte. */ diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index f81cf489d2..1908b13db5 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -433,7 +433,7 @@ xml_send(PG_FUNCTION_ARGS) static void appendStringInfoText(StringInfo str, const text *t) { - appendBinaryStringInfo(str, VARDATA(t), VARSIZE(t) - VARHDRSZ); + appendBinaryStringInfo(str, VARDATA_ANY(t), VARSIZE_ANY_EXHDR(t)); } #endif @@ -466,9 +466,9 @@ Datum xmlcomment(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML - text *arg = PG_GETARG_TEXT_P(0); - char *argdata = VARDATA(arg); - int len = VARSIZE(arg) - VARHDRSZ; + text *arg = PG_GETARG_TEXT_PP(0); + char *argdata = VARDATA_ANY(arg); + int len = VARSIZE_ANY_EXHDR(arg); StringInfoData buf; int i; @@ -590,7 +590,7 @@ xmlconcat2(PG_FUNCTION_ARGS) Datum texttoxml(PG_FUNCTION_ARGS) { - text *data = PG_GETARG_TEXT_P(0); + text *data = PG_GETARG_TEXT_PP(0); PG_RETURN_XML_P(xmlparse(data, xmloption, true)); } @@ -1402,7 +1402,7 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, volatile xmlParserCtxtPtr ctxt = NULL; volatile xmlDocPtr doc = NULL; - len = VARSIZE(data) - VARHDRSZ; /* will be useful later */ + len = VARSIZE_ANY_EXHDR(data); /* will be useful later */ string = xml_text2xmlChar(data); utf8string = pg_do_encoding_conversion(string, @@ -3876,14 +3876,14 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces, datastr = VARDATA(data); len = VARSIZE(data) - VARHDRSZ; - xpath_len = VARSIZE(xpath_expr_text) - VARHDRSZ; + xpath_len = VARSIZE_ANY_EXHDR(xpath_expr_text); if (xpath_len == 0) ereport(ERROR, (errcode(ERRCODE_DATA_EXCEPTION), errmsg("empty XPath expression"))); string = pg_xmlCharStrndup(datastr, len); - xpath_expr = pg_xmlCharStrndup(VARDATA(xpath_expr_text), xpath_len); + xpath_expr = pg_xmlCharStrndup(VARDATA_ANY(xpath_expr_text), xpath_len); xmlerrcxt = pg_xml_init(PG_XML_STRICTNESS_ALL); @@ -4001,7 +4001,7 @@ Datum xpath(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML - text *xpath_expr_text = PG_GETARG_TEXT_P(0); + text *xpath_expr_text = PG_GETARG_TEXT_PP(0); xmltype *data = PG_GETARG_XML_P(1); ArrayType *namespaces = PG_GETARG_ARRAYTYPE_P(2); ArrayBuildState *astate; @@ -4024,7 +4024,7 @@ Datum xmlexists(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML - text *xpath_expr_text = PG_GETARG_TEXT_P(0); + text *xpath_expr_text = PG_GETARG_TEXT_PP(0); xmltype *data = PG_GETARG_XML_P(1); int res_nitems; @@ -4047,7 +4047,7 @@ Datum xpath_exists(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML - text *xpath_expr_text = PG_GETARG_TEXT_P(0); + text *xpath_expr_text = PG_GETARG_TEXT_PP(0); xmltype *data = PG_GETARG_XML_P(1); ArrayType *namespaces = PG_GETARG_ARRAYTYPE_P(2); int res_nitems; @@ -4097,7 +4097,7 @@ Datum xml_is_well_formed(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML - text *data = PG_GETARG_TEXT_P(0); + text *data = PG_GETARG_TEXT_PP(0); PG_RETURN_BOOL(wellformed_xml(data, xmloption)); #else @@ -4110,7 +4110,7 @@ Datum xml_is_well_formed_document(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML - text *data = PG_GETARG_TEXT_P(0); + text *data = PG_GETARG_TEXT_PP(0); PG_RETURN_BOOL(wellformed_xml(data, XMLOPTION_DOCUMENT)); #else @@ -4123,7 +4123,7 @@ Datum xml_is_well_formed_content(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML - text *data = PG_GETARG_TEXT_P(0); + text *data = PG_GETARG_TEXT_PP(0); PG_RETURN_BOOL(wellformed_xml(data, XMLOPTION_CONTENT)); #else diff --git a/src/backend/utils/misc/rls.c b/src/backend/utils/misc/rls.c index faf1599404..49c03d3f88 100644 --- a/src/backend/utils/misc/rls.c +++ b/src/backend/utils/misc/rls.c @@ -154,7 +154,7 @@ Datum row_security_active_name(PG_FUNCTION_ARGS) { /* By qualified name */ - text *tablename = PG_GETARG_TEXT_P(0); + text *tablename = PG_GETARG_TEXT_PP(0); RangeVar *tablerel; Oid tableoid; int rls_status; diff --git a/src/pl/plperl/Util.xs b/src/pl/plperl/Util.xs index 8c3c47fec9..dbba0d7b87 100644 --- a/src/pl/plperl/Util.xs +++ b/src/pl/plperl/Util.xs @@ -116,7 +116,7 @@ util_quote_literal(sv) } else { text *arg = sv2text(sv); - text *quoted = DatumGetTextP(DirectFunctionCall1(quote_literal, PointerGetDatum(arg))); + text *quoted = DatumGetTextPP(DirectFunctionCall1(quote_literal, PointerGetDatum(arg))); char *str; pfree(arg); @@ -138,7 +138,7 @@ util_quote_nullable(sv) else { text *arg = sv2text(sv); - text *quoted = DatumGetTextP(DirectFunctionCall1(quote_nullable, PointerGetDatum(arg))); + text *quoted = DatumGetTextPP(DirectFunctionCall1(quote_nullable, PointerGetDatum(arg))); char *str; pfree(arg); @@ -158,7 +158,7 @@ util_quote_ident(sv) char *str; CODE: arg = sv2text(sv); - quoted = DatumGetTextP(DirectFunctionCall1(quote_ident, PointerGetDatum(arg))); + quoted = DatumGetTextPP(DirectFunctionCall1(quote_ident, PointerGetDatum(arg))); pfree(arg); str = text_to_cstring(quoted); @@ -175,9 +175,9 @@ util_decode_bytea(sv) text *ret; CODE: arg = SvPVbyte_nolen(sv); - ret = DatumGetTextP(DirectFunctionCall1(byteain, PointerGetDatum(arg))); + ret = DatumGetTextPP(DirectFunctionCall1(byteain, PointerGetDatum(arg))); /* not cstr2sv because this is raw bytes not utf8'able */ - RETVAL = newSVpvn(VARDATA(ret), (VARSIZE(ret) - VARHDRSZ)); + RETVAL = newSVpvn(VARDATA_ANY(ret), VARSIZE_ANY_EXHDR(ret)); OUTPUT: RETVAL diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c index 06743e46ed..2962d5a626 100644 --- a/src/pl/plpython/plpy_typeio.c +++ b/src/pl/plpython/plpy_typeio.c @@ -603,9 +603,9 @@ PLyLong_FromOid(PLyDatumToOb *arg, Datum d) static PyObject * PLyBytes_FromBytea(PLyDatumToOb *arg, Datum d) { - text *txt = DatumGetByteaP(d); - char *str = VARDATA(txt); - size_t size = VARSIZE(txt) - VARHDRSZ; + text *txt = DatumGetByteaPP(d); + char *str = VARDATA_ANY(txt); + size_t size = VARSIZE_ANY_EXHDR(txt); return PyBytes_FromStringAndSize(str, size); } -- cgit v1.2.3