Received: from femail4.sdc1.sfba.home.com (femail4.sdc1.sfba.home.com [24.0.95.84]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0S48uq21241 for ; Sat, 27 Jan 2001 23:08:56 -0500 (EST) (envelope-from joe.conway@mail.com) Received: from jecw2k1 ([24.0.42.111]) by femail4.sdc1.sfba.home.com (InterMail vM.4.01.03.00 201-229-121) with SMTP id <20010128040643.MTNN11986.femail4.sdc1.sfba.home.com@jecw2k1>; Sat, 27 Jan 2001 20:06:43 -0800 Message-ID: <01ef01c088df$fa17eb50$0705a8c0@jecw2k1> Reply-To: "Joe Conway" From: "Joe Conway" To: "Tom Lane" Cc: References: <01aa01c088d4$cae4f220$0705a8c0@jecw2k1> <29142.980653714@sss.pgh.pa.us> Subject: Re: libpq/c function question Date: Sat, 27 Jan 2001 20:08:31 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200101/314 X-Sequence-Number: 940 > "Joe Conway" writes: > > optstr = PG_GETARG_TEXT_P(0); > > jpgsql = PG_GETARG_TEXT_P(1); > > > conn = PQconnectdb(VARDATA(optstr)); > > I think you've missed the fact that a TEXT value's VARDATA is not > null-terminated. There are numerous examples of transforming a TEXT > into a C string in the backend, see for example text_cmp/varstr_cmp > in src/backend/utils/adt/varlena.c. > > regards, tom lane That did the trick! Thank you!! Joe