summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/prep
diff options
context:
space:
mode:
authorHiroshi Inoue <inoue@tpf.co.jp>2000-03-09 05:00:26 +0000
committerHiroshi Inoue <inoue@tpf.co.jp>2000-03-09 05:00:26 +0000
commitfd9ff86bd9c4f1a96f3796212212b4099ca275de (patch)
treedb51e5e26579069c839261a7c6d21a3b329d0c3b /src/backend/optimizer/prep
parent6513946cbbb0b06a9d764900a6db8ff88578f65c (diff)
downloadpostgresql-fd9ff86bd9c4f1a96f3796212212b4099ca275de.tar.gz
Trial implementation of ALTER DROP COLUMN.
They are #ifdef'd. Add -D_DROP_COLUMN_HACK__ compile option to evaluate it.
Diffstat (limited to 'src/backend/optimizer/prep')
-rw-r--r--src/backend/optimizer/prep/preptlist.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 8c6c2ceb8d..22ed6f418f 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.34 2000/01/26 05:56:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.35 2000/03/09 05:00:24 inoue Exp $
*
*-------------------------------------------------------------------------
*/
@@ -189,10 +189,20 @@ expand_targetlist(List *tlist, int command_type,
{
case CMD_INSERT:
{
+#ifdef _DROP_COLUMN_HACK__
+ Datum typedefault;
+#else
Datum typedefault = get_typdefault(atttype);
+#endif /* _DROP_COLUMN_HACK__ */
int typlen;
Const *temp_const;
+#ifdef _DROP_COLUMN_HACK__
+ if (COLUMN_IS_DROPPED(att_tup))
+ typedefault = PointerGetDatum(NULL);
+ else
+ typedefault = get_typdefault(atttype);
+#endif /* _DROP_COLUMN_HACK__ */
if (typedefault == PointerGetDatum(NULL))
typlen = 0;
else
@@ -230,8 +240,25 @@ expand_targetlist(List *tlist, int command_type,
{
Var *temp_var;
+#ifdef _DROP_COLUMN_HACK__
+ Node *temp_node = (Node *) NULL;
+ if (COLUMN_IS_DROPPED(att_tup))
+ {
+ temp_node = (Node *)makeConst(atttype, 0,
+ PointerGetDatum(NULL),
+ true,
+ false,
+ false, /* not a set */
+ false);
+ }
+ else
+#endif /* _DROP_COLUMN_HACK__ */
temp_var = makeVar(result_relation, attrno, atttype,
atttypmod, 0);
+#ifdef _DROP_COLUMN_HACK__
+ if (!temp_node)
+ temp_node = (Node *) temp_var;
+#endif /* _DROP_COLUMN_HACK__ */
new_tle = makeTargetEntry(makeResdom(attrno,
atttype,
@@ -239,8 +266,12 @@ expand_targetlist(List *tlist, int command_type,
pstrdup(attrname),
0,
(Oid) 0,
- false),
- (Node *) temp_var);
+ false),
+#ifdef _DROP_COLUMN_HACK__
+ temp_node);
+#else
+ (Node *) temp_var);
+#endif /* _DROP_COLUMN_HACK__ */
break;
}
default: