Skip to content
Snippets Groups Projects
Commit a5e9e51f authored by Bruce Momjian's avatar Bruce Momjian
Browse files

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
parent 92e100dd
No related branches found
No related tags found
No related merge requests found
...@@ -309,6 +309,7 @@ timetravel(PG_FUNCTION_ARGS) ...@@ -309,6 +309,7 @@ timetravel(PG_FUNCTION_ARGS)
void *pplan; void *pplan;
Oid *ctypes; Oid *ctypes;
char sql[8192]; char sql[8192];
char separ=' ';
/* allocate ctypes for preparation */ /* allocate ctypes for preparation */
ctypes = (Oid *) palloc(natts * sizeof(Oid)); ctypes = (Oid *) palloc(natts * sizeof(Oid));
...@@ -321,13 +322,12 @@ timetravel(PG_FUNCTION_ARGS) ...@@ -321,13 +322,12 @@ timetravel(PG_FUNCTION_ARGS)
{ {
ctypes[i - 1] = SPI_gettypeid(tupdesc, i); ctypes[i - 1] = SPI_gettypeid(tupdesc, i);
if (!(tupdesc->attrs[i - 1]->attisdropped)) /* skip dropped columns */ if (!(tupdesc->attrs[i - 1]->attisdropped)) /* skip dropped columns */
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "$%d%s", {
i, (i < natts) ? ", " : ")"); snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%c$%d", separ,i);
#if 0 separ = ',';
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), ")");
elog(DEBUG4, "timetravel (%s) update: sql: %s", relname, sql); elog(DEBUG4, "timetravel (%s) update: sql: %s", relname, sql);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment