Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
17841ddb
Commit
17841ddb
authored
Oct 20, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error reporting in parseTypeString(), motivated by confusing
behavior reported by Martin Marques.
parent
3b72087b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
6 deletions
+28
-6
src/backend/parser/parse_type.c
src/backend/parser/parse_type.c
+28
-6
No files found.
src/backend/parser/parse_type.c
View file @
17841ddb
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.6
2 2003/09/25 06:58:01 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.6
3 2003/10/20 17:25:42 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -430,14 +430,21 @@ typeidTypeRelid(Oid type_id)
return
result
;
}
/*
* error context callback for parse failure during parseTypeString()
*/
static
void
pts_error_callback
(
void
*
arg
)
{
const
char
*
str
=
(
const
char
*
)
arg
;
errcontext
(
"invalid type name
\"
%s
\"
"
,
str
);
}
/*
* Given a string that is supposed to be a SQL-compatible type declaration,
* such as "int4" or "integer" or "character varying(32)", parse
* the string and convert it to a type OID and type modifier.
*
* This routine is not currently used by the main backend, but it is
* exported for use by add-on modules such as plpgsql, in hopes of
* centralizing parsing knowledge about SQL type declarations.
*/
void
parseTypeString
(
const
char
*
str
,
Oid
*
type_id
,
int32
*
typmod
)
...
...
@@ -448,12 +455,27 @@ parseTypeString(const char *str, Oid *type_id, int32 *typmod)
ResTarget
*
restarget
;
TypeCast
*
typecast
;
TypeName
*
typename
;
ErrorContextCallback
ptserrcontext
;
/* make sure we give useful error for empty input */
if
(
strspn
(
str
,
"
\t\n\r\f
"
)
==
strlen
(
str
))
goto
fail
;
initStringInfo
(
&
buf
);
appendStringInfo
(
&
buf
,
"SELECT (NULL::%s)"
,
str
);
appendStringInfo
(
&
buf
,
"SELECT NULL::%s"
,
str
);
/*
* Setup error traceback support in case of ereport() during parse
*/
ptserrcontext
.
callback
=
pts_error_callback
;
ptserrcontext
.
arg
=
(
void
*
)
str
;
ptserrcontext
.
previous
=
error_context_stack
;
error_context_stack
=
&
ptserrcontext
;
raw_parsetree_list
=
raw_parser
(
buf
.
data
);
error_context_stack
=
ptserrcontext
.
previous
;
/*
* Make sure we got back exactly what we expected and no more;
* paranoia is justified since the string might contain anything.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment