pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alberto Cabello Sanchez <alberto@unex.es>
To: pgsql-interfaces@postgresql.org
Subject: ColumnName and ColumnNumber in libpq (C interface)
Date: Mon, 15 Sep 2003 09:11:25 +0200
Message-ID: <20030915071125.GA7389@guadiana.unex.es> (raw)

I think this behaviour is not fine:
I create a table with
CREATE TABLE foo ("Bar" VARCHAR(1));

I thougth running this helloworldish C program:

#include <stdio.h>
#include <libpq-fe.h>
 
int main(int argc,char **argv)
{
        PGconn * conn = PQconnectdb("dbname=pruebas");
        PGresult * res = PQexec(conn,"SELECT * from foo");
        printf("%s\n",PQfname(res,0));
        printf("%d\n",PQfnumber(res,"Bar"));
        PQfinish(conn);
}

should print 

Bar
0

but stdout shows

Bar
-1

What is happening? Any ideas? Is this a bug, a feature or something I'm missing?

-- 
-----------------------
Alberto Cabello Sánchez
alberto@unex.es
Servicio de Informática
924 289 351
-----------------------



view thread (7+ messages)  latest in thread

Message-ID: <20030915071125.GA7389@guadiana.unex.es>
Permalink:  ../20030915071125.GA7389@guadiana.unex.es/
Also on:    postgresql.org/message-id/20030915071125.GA7389@guadiana.unex.es

 · 

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: alberto@unex.es
  Subject: Re: ColumnName and ColumnNumber in libpq (C interface)
  In-Reply-To: <20030915071125.GA7389@guadiana.unex.es>

* 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