Re: libpq/c function question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joe Conway" <joe(dot)conway(at)mail(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq/c function question
Date: 2001-01-28 03:48:34
Message-ID: 29142.980653714@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

"Joe Conway" <joe(dot)conway(at)mail(dot)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

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Joe Conway 2001-01-28 04:08:31 Re: libpq/c function question
Previous Message Joe Conway 2001-01-28 02:48:28 libpq/c function question