Re: Handling bytea field in partition trigger function

From: Noah Misch <noah(at)leadboat(dot)com>
To: Doug Johnson <dojohnso(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Handling bytea field in partition trigger function
Date: 2011-04-10 10:08:50
Message-ID: 20110410100850.GA10697@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 01, 2011 at 04:09:00PM -0700, Doug Johnson wrote:
> I'm trying to partition a table that has a btyea field used to store pdf
> data. Basically the procedure filters by date, and creates a new table every
> month. I'm having problems with the executed sql string that moves the data
> into the partitioned table from the main insert.
>
> I'm setting
>
> n_document_object bytea := NEW.document_object;
>
> but then the string executed doesn't work. So I'm thinking I need to bind
> within the function, but I can figure out how. I'm having a hard time
> finding answers because I'm not exactly sure what I need to ask.

Look at the "quote_nullable" function and the EXECUTE ... USING syntax:

http://www.postgresql.org/docs/9.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

If those don't cover your needs, please post the entire function definition and
the exact error message you receive.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Noah Misch 2011-04-10 10:12:39 Re: Transaction wraparound vacuum synchronicity
Previous Message John R Pierce 2011-04-10 05:37:57 Re: searchable database