Commit 46f4ed49 authored by Bruce Momjian's avatar Bruce Momjian

Allocate proper length for sprintf string, from Tatsuo.

parent ea0b5c85
/**************************************************************************** /****************************************************************************
* pending.c * pending.c
* $Id: pending.c,v 1.9 2002/11/22 16:25:29 tgl Exp $ * $Id: pending.c,v 1.10 2002/11/26 03:08:00 momjian Exp $
* *
* This file contains a trigger for Postgresql-7.x to record changes to tables * This file contains a trigger for Postgresql-7.x to record changes to tables
* to a pending table for mirroring. * to a pending table for mirroring.
...@@ -95,11 +95,11 @@ recordchange(PG_FUNCTION_ARGS) ...@@ -95,11 +95,11 @@ recordchange(PG_FUNCTION_ARGS)
#ifndef NOSCHEMAS #ifndef NOSCHEMAS
schemaname = get_namespace_name(RelationGetNamespace(trigdata->tg_relation)); schemaname = get_namespace_name(RelationGetNamespace(trigdata->tg_relation));
fullyqualtblname = SPI_palloc(strlen(tblname) + fullyqualtblname = SPI_palloc(strlen(tblname) +
strlen(schemaname) + 4); strlen(schemaname) + 6);
sprintf(fullyqualtblname,"\"%s\".\"%s\"", sprintf(fullyqualtblname,"\"%s\".\"%s\"",
schemaname,tblname); schemaname,tblname);
#else #else
fullyqualtblname = SPI_palloc(strlen(tblname+3)); fullyqualtblname = SPI_palloc(strlen(tblname + 3));
sprintf(fullyqualtblname,"\"%s\"",tblname); sprintf(fullyqualtblname,"\"%s\"",tblname);
#endif #endif
tupdesc = trigdata->tg_relation->rd_att; tupdesc = trigdata->tg_relation->rd_att;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment