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
7d5edf2b
Commit
7d5edf2b
authored
Mar 06, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new elog() levels to stored procedure languages. plperl DEBUG hack
still needed because only removed in 7.4.
parent
9956c566
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
111 additions
and
35 deletions
+111
-35
src/pl/plperl/SPI.xs
src/pl/plperl/SPI.xs
+13
-5
src/pl/plperl/eloglvl.c
src/pl/plperl/eloglvl.c
+21
-2
src/pl/plperl/eloglvl.h
src/pl/plperl/eloglvl.h
+10
-5
src/pl/plperl/plperl.c
src/pl/plperl/plperl.c
+2
-2
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/gram.y
+16
-1
src/pl/plpgsql/src/scan.l
src/pl/plpgsql/src/scan.l
+4
-1
src/pl/plpython/error.expected
src/pl/plpython/error.expected
+3
-3
src/pl/plpython/feature.expected
src/pl/plpython/feature.expected
+1
-1
src/pl/plpython/plpython.c
src/pl/plpython/plpython.c
+35
-11
src/pl/tcl/pltcl.c
src/pl/tcl/pltcl.c
+6
-4
No files found.
src/pl/plperl/SPI.xs
View file @
7d5edf2b
...
@@ -55,17 +55,25 @@ elog_elog(level, message)
...
@@ -55,17 +55,25 @@ elog_elog(level, message)
int level
int level
char* message
char* message
CODE:
CODE:
if (level > 0)
elog(level, message);
return;
else
elog(level, message);
int
int
elog_DEBUG()
elog_DEBUG()
int
int
elog_ERROR()
elog_LOG()
int
elog_INFO()
int
int
elog_NOTICE()
elog_NOTICE()
int
elog_WARNING()
int
elog_ERROR()
src/pl/plperl/eloglvl.c
View file @
7d5edf2b
...
@@ -12,14 +12,20 @@
...
@@ -12,14 +12,20 @@
int
int
elog_DEBUG
(
void
)
elog_DEBUG
(
void
)
{
return
DEBUG1
;
}
int
elog_LOG
(
void
)
{
{
return
LOG
;
return
LOG
;
}
}
int
int
elog_
ERROR
(
void
)
elog_
INFO
(
void
)
{
{
return
ERROR
;
return
INFO
;
}
}
int
int
...
@@ -27,3 +33,16 @@ elog_NOTICE(void)
...
@@ -27,3 +33,16 @@ elog_NOTICE(void)
{
{
return
NOTICE
;
return
NOTICE
;
}
}
int
elog_WARNING
(
void
)
{
return
WARNING
;
}
int
elog_ERROR
(
void
)
{
return
ERROR
;
}
src/pl/plperl/eloglvl.h
View file @
7d5edf2b
int
int
elog_DEBUG
(
void
);
elog_DEBUG
(
void
);
int
int
elog_LOG
(
void
);
elog_ERROR
(
void
);
int
elog_INFO
(
void
);
int
elog_NOTICE
(
void
);
int
elog_WARNING
(
void
);
int
elog_ERROR
(
void
);
int
elog_NOTICE
(
void
);
src/pl/plperl/plperl.c
View file @
7d5edf2b
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
* ENHANCEMENTS, OR MODIFICATIONS.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.2
8 2002/01/24 21:40:44 tgl
Exp $
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.2
9 2002/03/06 18:50:26 momjian
Exp $
*
*
**********************************************************************/
**********************************************************************/
...
@@ -210,7 +210,7 @@ plperl_init_interp(void)
...
@@ -210,7 +210,7 @@ plperl_init_interp(void)
*/
*/
"require Safe; SPI::bootstrap();"
"require Safe; SPI::bootstrap();"
"sub ::mksafefunc { my $x = new Safe; $x->permit_only(':default');$x->permit(':base_math');"
"sub ::mksafefunc { my $x = new Safe; $x->permit_only(':default');$x->permit(':base_math');"
"$x->share(qw[&elog &DEBUG &
NOTICE
&ERROR]);"
"$x->share(qw[&elog &DEBUG &
LOG &INFO &NOTICE &WARNING
&ERROR]);"
" return $x->reval(qq[sub { $_[0] }]); }"
" return $x->reval(qq[sub { $_[0] }]); }"
"sub ::mkunsafefunc {return eval(qq[ sub { $_[0] } ]); }"
"sub ::mkunsafefunc {return eval(qq[ sub { $_[0] } ]); }"
};
};
...
...
src/pl/plpgsql/src/gram.y
View file @
7d5edf2b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* procedural language
* procedural language
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.3
0 2002/03/02 21:39:35
momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.3
1 2002/03/06 18:50:29
momjian Exp $
*
*
* This software is copyrighted by Jan Wieck - Hamburg.
* This software is copyrighted by Jan Wieck - Hamburg.
*
*
...
@@ -161,8 +161,10 @@ static PLpgSQL_expr *make_tupret_expr(PLpgSQL_row *row);
...
@@ -161,8 +161,10 @@ static PLpgSQL_expr *make_tupret_expr(PLpgSQL_row *row);
%token K_GET
%token K_GET
%token K_IF
%token K_IF
%token K_IN
%token K_IN
%token K_INFO
%token K_INTO
%token K_INTO
%token K_IS
%token K_IS
%token K_LOG
%token K_LOOP
%token K_LOOP
%token K_NOT
%token K_NOT
%token K_NOTICE
%token K_NOTICE
...
@@ -180,6 +182,7 @@ static PLpgSQL_expr *make_tupret_expr(PLpgSQL_row *row);
...
@@ -180,6 +182,7 @@ static PLpgSQL_expr *make_tupret_expr(PLpgSQL_row *row);
%token K_THEN
%token K_THEN
%token K_TO
%token K_TO
%token K_TYPE
%token K_TYPE
%token K_WARNING
%token K_WHEN
%token K_WHEN
%token K_WHILE
%token K_WHILE
...
@@ -1201,10 +1204,22 @@ raise_level : K_EXCEPTION
...
@@ -1201,10 +1204,22 @@ raise_level : K_EXCEPTION
{
{
$$ = ERROR;
$$ = ERROR;
}
}
| K_WARNING
{
$$ = WARNING;
}
| K_NOTICE
| K_NOTICE
{
{
$$ = NOTICE;
$$ = NOTICE;
}
}
| K_INFO
{
$$ = INFO;
}
| K_LOG
{
$$ = LOG;
}
| K_DEBUG
| K_DEBUG
{
{
$$ = DEBUG5;
$$ = DEBUG5;
...
...
src/pl/plpgsql/src/scan.l
View file @
7d5edf2b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* procedural language
* procedural language
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.1
6 2001/10/09 15:59:56 tgl
Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.1
7 2002/03/06 18:50:29 momjian
Exp $
*
*
* This software is copyrighted by Jan Wieck - Hamburg.
* This software is copyrighted by Jan Wieck - Hamburg.
*
*
...
@@ -117,8 +117,10 @@ from { return K_FROM; }
...
@@ -117,8 +117,10 @@ from { return K_FROM; }
get { return K_GET; }
get { return K_GET; }
if { return K_IF; }
if { return K_IF; }
in { return K_IN; }
in { return K_IN; }
info { return K_INFO; }
into { return K_INTO; }
into { return K_INTO; }
is { return K_IS; }
is { return K_IS; }
log { return K_LOG; }
loop { return K_LOOP; }
loop { return K_LOOP; }
not { return K_NOT; }
not { return K_NOT; }
notice { return K_NOTICE; }
notice { return K_NOTICE; }
...
@@ -136,6 +138,7 @@ select { return K_SELECT; }
...
@@ -136,6 +138,7 @@ select { return K_SELECT; }
then { return K_THEN; }
then { return K_THEN; }
to { return K_TO; }
to { return K_TO; }
type { return K_TYPE; }
type { return K_TYPE; }
warning { return K_WARNING; }
when { return K_WHEN; }
when { return K_WHEN; }
while { return K_WHILE; }
while { return K_WHILE; }
...
...
src/pl/plpython/error.expected
View file @
7d5edf2b
SELECT invalid_type_uncaught('rick');
SELECT invalid_type_uncaught('rick');
NOTICE
: plpython: in function __plpython_procedure_invalid_type_uncaught_49801:
WARNING
: plpython: in function __plpython_procedure_invalid_type_uncaught_49801:
plpy.SPIError: Cache lookup for type `test' failed.
plpy.SPIError: Cache lookup for type `test' failed.
SELECT invalid_type_caught('rick');
SELECT invalid_type_caught('rick');
NOTICE
: plpython: in function __plpython_procedure_invalid_type_caught_49802:
WARNING
: plpython: in function __plpython_procedure_invalid_type_caught_49802:
plpy.SPIError: Cache lookup for type `test' failed.
plpy.SPIError: Cache lookup for type `test' failed.
SELECT invalid_type_reraised('rick');
SELECT invalid_type_reraised('rick');
NOTICE
: plpython: in function __plpython_procedure_invalid_type_reraised_49803:
WARNING
: plpython: in function __plpython_procedure_invalid_type_reraised_49803:
plpy.SPIError: Cache lookup for type `test' failed.
plpy.SPIError: Cache lookup for type `test' failed.
SELECT valid_type('rick');
SELECT valid_type('rick');
valid_type
valid_type
...
...
src/pl/plpython/feature.expected
View file @
7d5edf2b
...
@@ -29,7 +29,7 @@ SELECT global_test_two();
...
@@ -29,7 +29,7 @@ SELECT global_test_two();
(1 row)
(1 row)
SELECT import_fail();
SELECT import_fail();
NOTICE
: ('import socket failed -- untrusted dynamic module: _socket',)
WARNING
: ('import socket failed -- untrusted dynamic module: _socket',)
import_fail
import_fail
--------------------
--------------------
failed as expected
failed as expected
...
...
src/pl/plpython/plpython.c
View file @
7d5edf2b
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.1
5 2002/03/06 06:10:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.1
6 2002/03/06 18:50:32
momjian Exp $
*
*
*********************************************************************
*********************************************************************
*/
*/
...
@@ -1658,9 +1658,12 @@ PLyDict_FromTuple(PLyTypeInfo * info, HeapTuple tuple, TupleDesc desc)
...
@@ -1658,9 +1658,12 @@ PLyDict_FromTuple(PLyTypeInfo * info, HeapTuple tuple, TupleDesc desc)
/* interface to postgresql elog
/* interface to postgresql elog
*/
*/
static
PyObject
*
PLy_debug
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_debug
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_log
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_info
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_notice
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_warning
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_error
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_error
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_fatal
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_fatal
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_notice
(
PyObject
*
,
PyObject
*
);
/* PLyPlanObject, PLyResultObject and SPI interface
/* PLyPlanObject, PLyResultObject and SPI interface
*/
*/
...
@@ -1782,9 +1785,12 @@ static PyMethodDef PLy_methods[] = {
...
@@ -1782,9 +1785,12 @@ static PyMethodDef PLy_methods[] = {
* logging methods
* logging methods
*/
*/
{
"debug"
,
PLy_debug
,
METH_VARARGS
,
NULL
},
{
"debug"
,
PLy_debug
,
METH_VARARGS
,
NULL
},
{
"log"
,
PLy_log
,
METH_VARARGS
,
NULL
},
{
"info"
,
PLy_info
,
METH_VARARGS
,
NULL
},
{
"notice"
,
PLy_notice
,
METH_VARARGS
,
NULL
},
{
"warning"
,
PLy_warning
,
METH_VARARGS
,
NULL
},
{
"error"
,
PLy_error
,
METH_VARARGS
,
NULL
},
{
"error"
,
PLy_error
,
METH_VARARGS
,
NULL
},
{
"fatal"
,
PLy_fatal
,
METH_VARARGS
,
NULL
},
{
"fatal"
,
PLy_fatal
,
METH_VARARGS
,
NULL
},
{
"notice"
,
PLy_notice
,
METH_VARARGS
,
NULL
},
/*
/*
* create a stored plan
* create a stored plan
...
@@ -2627,35 +2633,53 @@ populate_methods(PyObject *klass, PyMethodDef *methods)
...
@@ -2627,35 +2633,53 @@ populate_methods(PyObject *klass, PyMethodDef *methods)
/* the python interface to the elog function
/* the python interface to the elog function
* don't confuse these with PLy_elog
* don't confuse these with PLy_elog
*/
*/
static
PyObject
*
PLy_
log
(
int
,
PyObject
*
,
PyObject
*
);
static
PyObject
*
PLy_
output
(
int
,
PyObject
*
,
PyObject
*
);
PyObject
*
PyObject
*
PLy_debug
(
PyObject
*
self
,
PyObject
*
args
)
PLy_debug
(
PyObject
*
self
,
PyObject
*
args
)
{
{
return
PLy_
log
(
LOG
,
self
,
args
);
return
PLy_
output
(
DEBUG1
,
self
,
args
);
}
}
PyObject
*
PyObject
*
PLy_
error
(
PyObject
*
self
,
PyObject
*
args
)
PLy_
log
(
PyObject
*
self
,
PyObject
*
args
)
{
{
return
PLy_
log
(
ERROR
,
self
,
args
);
return
PLy_
output
(
LOG
,
self
,
args
);
}
}
PyObject
*
PyObject
*
PLy_
fatal
(
PyObject
*
self
,
PyObject
*
args
)
PLy_
info
(
PyObject
*
self
,
PyObject
*
args
)
{
{
return
PLy_
log
(
FATAL
,
self
,
args
);
return
PLy_
output
(
INFO
,
self
,
args
);
}
}
PyObject
*
PyObject
*
PLy_notice
(
PyObject
*
self
,
PyObject
*
args
)
PLy_notice
(
PyObject
*
self
,
PyObject
*
args
)
{
{
return
PLy_log
(
NOTICE
,
self
,
args
);
return
PLy_output
(
NOTICE
,
self
,
args
);
}
PyObject
*
PLy_warning
(
PyObject
*
self
,
PyObject
*
args
)
{
return
PLy_output
(
WARNING
,
self
,
args
);
}
PyObject
*
PLy_error
(
PyObject
*
self
,
PyObject
*
args
)
{
return
PLy_output
(
ERROR
,
self
,
args
);
}
PyObject
*
PLy_fatal
(
PyObject
*
self
,
PyObject
*
args
)
{
return
PLy_output
(
FATAL
,
self
,
args
);
}
}
PyObject
*
PyObject
*
PLy_
log
(
volatile
int
level
,
PyObject
*
self
,
PyObject
*
args
)
PLy_
output
(
volatile
int
level
,
PyObject
*
self
,
PyObject
*
args
)
{
{
DECLARE_EXC
();
DECLARE_EXC
();
PyObject
*
so
;
PyObject
*
so
;
...
...
src/pl/tcl/pltcl.c
View file @
7d5edf2b
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
* ENHANCEMENTS, OR MODIFICATIONS.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.5
1 2002/03/06 06:10:48
momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.5
2 2002/03/06 18:50:33
momjian Exp $
*
*
**********************************************************************/
**********************************************************************/
...
@@ -1259,7 +1259,11 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
...
@@ -1259,7 +1259,11 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
return
TCL_ERROR
;
return
TCL_ERROR
;
}
}
if
(
strcmp
(
argv
[
1
],
"INFO"
)
==
0
)
if
(
strcmp
(
argv
[
1
],
"DEBUG"
)
==
0
)
level
=
DEBUG1
;
else
if
(
strcmp
(
argv
[
1
],
"LOG"
)
==
0
)
level
=
LOG
;
else
if
(
strcmp
(
argv
[
1
],
"INFO"
)
==
0
)
level
=
INFO
;
level
=
INFO
;
else
if
(
strcmp
(
argv
[
1
],
"NOTICE"
)
==
0
)
else
if
(
strcmp
(
argv
[
1
],
"NOTICE"
)
==
0
)
level
=
NOTICE
;
level
=
NOTICE
;
...
@@ -1269,8 +1273,6 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
...
@@ -1269,8 +1273,6 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
level
=
ERROR
;
level
=
ERROR
;
else
if
(
strcmp
(
argv
[
1
],
"FATAL"
)
==
0
)
else
if
(
strcmp
(
argv
[
1
],
"FATAL"
)
==
0
)
level
=
FATAL
;
level
=
FATAL
;
else
if
(
strcmp
(
argv
[
1
],
"DEBUG"
)
==
0
)
level
=
DEBUG1
;
else
else
{
{
Tcl_AppendResult
(
interp
,
"Unknown elog level '"
,
argv
[
1
],
Tcl_AppendResult
(
interp
,
"Unknown elog level '"
,
argv
[
1
],
...
...
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