Skip site navigation (1) Skip section navigation (2)

Variable array sizes with PQexecParams

From: "Garcia, Joshua" <Joshua(dot)Garcia(at)xerox(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Variable array sizes with PQexecParams
Date: 2006-06-26 18:31:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I want to use PQexecParams to insert into a field that takes an array of
varchars.  I tried something like:


INSERT INTO table1(column1) VALUES ('{$1,$2}')


But, this just inserts {$1,$2} into the field.


However, I also want to be able to select at runtime the number of
elements I'll be inserting into the field.  For example, rather than
having two elements in the array as I tried above, I just want one
element as shown below:


INSERT INTO table1(column1) VALUES ($1)


How can I do all this?


Thanks in advance,




pgsql-novice by date

Next:From: operationsengineer1Date: 2006-06-26 18:47:23
Subject: Table Merge Successful, Primary Keys Missing
Previous:From: Richard Broersma JrDate: 2006-06-26 14:49:00
Subject: Re: Copy Data Question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group