mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Expose quote_literal_cstr() from core.
This eliminates the need for inefficient implementions of this functionality in both contrib/dblink and contrib/tablefunc, so remove them. The upcoming patch implementing an in-core format() function will also require this functionality. In passing, add some regression tests.
This commit is contained in:
@ -85,7 +85,6 @@ static Tuplestorestate *build_tuplestore_recursively(char *key_fld,
|
||||
MemoryContext per_query_ctx,
|
||||
AttInMetadata *attinmeta,
|
||||
Tuplestorestate *tupstore);
|
||||
static char *quote_literal_cstr(char *rawstr);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -1564,22 +1563,3 @@ compatCrosstabTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc)
|
||||
/* OK, the two tupdescs are compatible for our purposes */
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a properly quoted literal value.
|
||||
* Uses quote_literal in quote.c
|
||||
*/
|
||||
static char *
|
||||
quote_literal_cstr(char *rawstr)
|
||||
{
|
||||
text *rawstr_text;
|
||||
text *result_text;
|
||||
char *result;
|
||||
|
||||
rawstr_text = cstring_to_text(rawstr);
|
||||
result_text = DatumGetTextP(DirectFunctionCall1(quote_literal,
|
||||
PointerGetDatum(rawstr_text)));
|
||||
result = text_to_cstring(result_text);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user