diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-09-01 20:42:46 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-09-01 20:42:46 +0000 |
commit | b153c0920960a6059b67969469166fb29c0105d7 (patch) | |
tree | 4e7100ecdca88746c369ae2a6a43468925f3194d /src/backend/utils/error/elog.c | |
parent | 9ac4299163247645c6e391f5f65735c6cb78ccb9 (diff) | |
download | postgresql-b153c0920960a6059b67969469166fb29c0105d7.tar.gz postgresql-b153c0920960a6059b67969469166fb29c0105d7.zip |
Add a bunch of new error location reports to parse-analysis error messages.
There are still some weak spots around JOIN USING and relation alias lists,
but most errors reported within backend/parser/ now have locations.
Diffstat (limited to 'src/backend/utils/error/elog.c')
-rw-r--r-- | src/backend/utils/error/elog.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 46b7853e50a..d2315fb1f6b 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -42,7 +42,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.205 2008/07/09 15:56:49 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.206 2008/09/01 20:42:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -880,6 +880,23 @@ internalerrquery(const char *query) } /* + * geterrcode --- return the currently set SQLSTATE error code + * + * This is only intended for use in error callback subroutines, since there + * is no other place outside elog.c where the concept is meaningful. + */ +int +geterrcode(void) +{ + ErrorData *edata = &errordata[errordata_stack_depth]; + + /* we don't bother incrementing recursion_depth */ + CHECK_STACK_DEPTH(); + + return edata->sqlerrcode; +} + +/* * geterrposition --- return the currently set error position (0 if none) * * This is only intended for use in error callback subroutines, since there |