From 9048b73184b6852b71faf4481b75ab5850a9cd1b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 22 Sep 2009 23:43:43 +0000 Subject: Implement the DO statement to support execution of PL code without having to create a function for it. Procedural languages now have an additional entry point, namely a function to execute an inline code block. This seemed a better design than trying to hide the transient-ness of the code from the PL. As of this patch, only plpgsql has an inline handler, but probably people will soon write handlers for the other standard PLs. In passing, remove the long-dead LANCOMPILER option of CREATE LANGUAGE. Petr Jelinek --- src/backend/nodes/copyfuncs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/backend/nodes/copyfuncs.c') diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 48039b86cb9..5feff5d1691 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.437 2009/07/30 02:45:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.438 2009/09/22 23:43:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2561,6 +2561,16 @@ _copyRemoveFuncStmt(RemoveFuncStmt *from) return newnode; } +static DoStmt * +_copyDoStmt(DoStmt *from) +{ + DoStmt *newnode = makeNode(DoStmt); + + COPY_NODE_FIELD(args); + + return newnode; +} + static RemoveOpClassStmt * _copyRemoveOpClassStmt(RemoveOpClassStmt *from) { @@ -3104,6 +3114,7 @@ _copyCreatePLangStmt(CreatePLangStmt *from) COPY_STRING_FIELD(plname); COPY_NODE_FIELD(plhandler); + COPY_NODE_FIELD(plinline); COPY_NODE_FIELD(plvalidator); COPY_SCALAR_FIELD(pltrusted); @@ -3797,6 +3808,9 @@ copyObject(void *from) case T_RemoveFuncStmt: retval = _copyRemoveFuncStmt(from); break; + case T_DoStmt: + retval = _copyDoStmt(from); + break; case T_RemoveOpClassStmt: retval = _copyRemoveOpClassStmt(from); break; -- cgit v1.2.3