summaryrefslogtreecommitdiff
path: root/contrib/dblink/dblink.c
diff options
context:
space:
mode:
authorNoah Misch2017-03-12 23:35:34 +0000
committerNoah Misch2017-03-12 23:35:34 +0000
commit3a0d473192b2045cbaf997df8437e7762d34f3ba (patch)
tree8bdf7e5e8f6a69041ff3fd4b2114cb9e8cbd69d4 /contrib/dblink/dblink.c
parent9d7726c2ba06b932f791f2d0cc5acf73cc0b4dca (diff)
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.
Diffstat (limited to 'contrib/dblink/dblink.c')
-rw-r--r--contrib/dblink/dblink.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index eba6f274dc6..1266a775306 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);