1
0
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:
Teodor Sigaev
2016-03-18 18:16:14 +03:00
parent 992b5ba30d
commit 3187d6de0e
10 changed files with 375 additions and 2 deletions

View File

@ -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.
*