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:
@ -91,7 +91,6 @@ static char **get_text_array_contents(ArrayType *array, int *numitems);
|
||||
static char *get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals, char **tgt_pkattvals);
|
||||
static char *get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals);
|
||||
static char *get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals, char **tgt_pkattvals);
|
||||
static char *quote_literal_cstr(char *rawstr);
|
||||
static char *quote_ident_cstr(char *rawstr);
|
||||
static int get_attnum_pk_pos(int *pkattnums, int pknumatts, int key);
|
||||
static HeapTuple get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals);
|
||||
@ -1893,25 +1892,6 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
|
||||
return (buf.data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a properly quoted identifier.
|
||||
* Uses quote_ident in quote.c
|
||||
|
Reference in New Issue
Block a user