diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2016-03-18 18:16:14 +0300 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2016-03-18 18:16:14 +0300 |
commit | 3187d6de0e5a9e805b27c48437897e8c39071d45 (patch) | |
tree | 73c8b2d0ffb1f9410ca5d59bc3b62c43febbf0ea /src/backend/parser/scansup.c | |
parent | 992b5ba30dcafdc222341505b072a6b009b248a7 (diff) | |
download | postgresql-3187d6de0e5a9e805b27c48437897e8c39071d45.tar.gz postgresql-3187d6de0e5a9e805b27c48437897e8c39071d45.zip |
Introduce parse_ident()
SQL-layer function to split qualified identifier into array parts.
Author: Pavel Stehule with minor editorization by me and Jim Nasby
Diffstat (limited to 'src/backend/parser/scansup.c')
-rw-r--r-- | src/backend/parser/scansup.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/parser/scansup.c b/src/backend/parser/scansup.c index 2b4ab202c34..7aa5b768411 100644 --- a/src/backend/parser/scansup.c +++ b/src/backend/parser/scansup.c @@ -130,6 +130,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; bool enc_is_single_byte; @@ -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. * |