1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Remove inappropriate double-quoting in connectby() code; adjust

regression test to avoid using VALUE as a name.  From Joe Conway.
This commit is contained in:
Tom Lane
2002-11-23 01:54:09 +00:00
parent e760d22391
commit 1f1c332381
4 changed files with 43 additions and 58 deletions

View File

@ -66,7 +66,6 @@ static Tuplestorestate *build_tuplestore_recursively(char *key_fld,
MemoryContext per_query_ctx,
AttInMetadata *attinmeta,
Tuplestorestate *tupstore);
static char *quote_ident_cstr(char *rawstr);
typedef struct
{
@ -776,12 +775,12 @@ build_tuplestore_recursively(char *key_fld,
/* Build initial sql statement */
appendStringInfo(sql, "SELECT %s, %s FROM %s WHERE %s = '%s' AND %s IS NOT NULL",
quote_ident_cstr(key_fld),
quote_ident_cstr(parent_key_fld),
quote_ident_cstr(relname),
quote_ident_cstr(parent_key_fld),
key_fld,
parent_key_fld,
relname,
parent_key_fld,
start_with,
quote_ident_cstr(key_fld));
key_fld);
/* Retrieve the desired rows */
ret = SPI_exec(sql->data, 0);
@ -1083,21 +1082,3 @@ make_crosstab_tupledesc(TupleDesc spi_tupdesc, int num_catagories)
return tupdesc;
}
/*
* Return a properly quoted identifier.
* Uses quote_ident in quote.c
*/
static char *
quote_ident_cstr(char *rawstr)
{
text *rawstr_text;
text *result_text;
char *result;
rawstr_text = DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(rawstr)));
result_text = DatumGetTextP(DirectFunctionCall1(quote_ident, PointerGetDatum(rawstr_text)));
result = DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(result_text)));
return result;
}