summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2002-03-25 07:41:21 +0000
committerTom Lane2002-03-25 07:41:21 +0000
commitdf739a02004b99c298819555d907c5793e21eb3a (patch)
treef3f43a8f87a4a9ec464bc96ad855017bcf660f3e
parentb2d05d58eb58a81bd7ba81e3d18755b354cd5655 (diff)
Re-allow CREATE AS (but not SELECT INTO) in EXECUTE.
-rw-r--r--src/pl/plpgsql/src/pl_exec.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index d61fac52897..b6d6df21c23 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.52 2001/11/15 23:31:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.52.2.1 2002/03/25 07:41:21 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -2019,13 +2019,25 @@ exec_stmt_dynexecute(PLpgSQL_execstate * estate,
case SPI_OK_SELINTO:
/*
- * Disallow this for now, because its behavior is not
- * consistent with SELECT INTO in a normal plpgsql context. We
- * need to reimplement EXECUTE to parse the string as a
- * plpgsql command, not just feed it to SPI_exec.
+ * We want to disallow SELECT INTO for now, because its behavior
+ * is not consistent with SELECT INTO in a normal plpgsql
+ * context. (We need to reimplement EXECUTE to parse the string
+ * as a plpgsql command, not just feed it to SPI_exec.)
+ * However, CREATE AS should be allowed ... and since it produces
+ * the same parsetree as SELECT INTO, there's no way to tell
+ * the difference except to look at the source text. Wotta
+ * kluge!
*/
- elog(ERROR, "EXECUTE of SELECT ... INTO is not implemented yet");
+ {
+ char *ptr;
+
+ for (ptr = querystr; *ptr; ptr++)
+ if (!isspace((unsigned char) *ptr))
+ break;
+ if (*ptr == 'S' || *ptr == 's')
+ elog(ERROR, "EXECUTE of SELECT ... INTO is not implemented yet");
break;
+ }
default:
elog(ERROR, "unexpected error %d in EXECUTE of query '%s'",