pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe Conway <joe.conway@mail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: libpq/c function question
Date: Sat, 27 Jan 2001 22:48:34 -0500
Message-ID: <29142.980653714@sss.pgh.pa.us> (raw)
In-Reply-To: <01aa01c088d4$cae4f220$0705a8c0@jecw2k1>
References: <Pine.GSO.4.10.10101251120200.21455-100000@sun4.plasma.ernet.in>
	<01aa01c088d4$cae4f220$0705a8c0@jecw2k1>

"Joe Conway" <joe.conway@mail.com> 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



view thread (3+ messages)  latest in thread

Message-ID: <29142.980653714@sss.pgh.pa.us>
Permalink:  ../29142.980653714@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29142.980653714@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, joe.conway@mail.com
  Subject: Re: libpq/c function question
  In-Reply-To: <29142.980653714@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox