summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2003-09-11 17:25:14 +0000
committerBruce Momjian2003-09-11 17:25:14 +0000
commita5e9e51fb05dd0968527b0f3f7632d2f824a8a16 (patch)
tree9a36fbebea1cbcb4c3a5ad4198c42f63f3aa5083
parent92e100dd33b1f71eca3f9d60b25cad1cd6793fb2 (diff)
on my timetravel.c I find a bug: after the
ALTER TABLE mytable drop column last_column_of_table; the timetravel trigger say on UPDATE/DELETE: ERROR: parser: parse error at end of input Here is the patch for this bug B?jthe Zolt?n
-rw-r--r--contrib/spi/timetravel.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c
index 8ffa56edc75..29de8c6fda4 100644
--- a/contrib/spi/timetravel.c
+++ b/contrib/spi/timetravel.c
@@ -309,6 +309,7 @@ timetravel(PG_FUNCTION_ARGS)
void *pplan;
Oid *ctypes;
char sql[8192];
+ char separ=' ';
/* allocate ctypes for preparation */
ctypes = (Oid *) palloc(natts * sizeof(Oid));
@@ -321,13 +322,12 @@ timetravel(PG_FUNCTION_ARGS)
{
ctypes[i - 1] = SPI_gettypeid(tupdesc, i);
if (!(tupdesc->attrs[i - 1]->attisdropped)) /* skip dropped columns */
- snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "$%d%s",
- i, (i < natts) ? ", " : ")");
-#if 0
- snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "$%d /* %d */ %s",
- i, ctypes[i - 1], (i < natts) ? ", " : ")");
-#endif
+ {
+ snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%c$%d", separ,i);
+ separ = ',';
+ }
}
+ snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), ")");
elog(DEBUG4, "timetravel (%s) update: sql: %s", relname, sql);