mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Introduce parse_ident()
SQL-layer function to split qualified identifier into array parts. Author: Pavel Stehule with minor editorization by me and Jim Nasby
This commit is contained in:
@ -129,6 +129,15 @@ scanstr(const char *s)
|
||||
*/
|
||||
char *
|
||||
downcase_truncate_identifier(const char *ident, int len, bool warn)
|
||||
{
|
||||
return downcase_identifier(ident, len, warn, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* a workhorse for downcase_truncate_identifier
|
||||
*/
|
||||
char *
|
||||
downcase_identifier(const char *ident, int len, bool warn, bool truncate)
|
||||
{
|
||||
char *result;
|
||||
int i;
|
||||
@ -158,12 +167,13 @@ downcase_truncate_identifier(const char *ident, int len, bool warn)
|
||||
}
|
||||
result[i] = '\0';
|
||||
|
||||
if (i >= NAMEDATALEN)
|
||||
if (i >= NAMEDATALEN && truncate)
|
||||
truncate_identifier(result, i, warn);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* truncate_identifier() --- truncate an identifier to NAMEDATALEN-1 bytes.
|
||||
*
|
||||
|
Reference in New Issue
Block a user