Re: [GENERAL] libpq confusion - Mailing list pgsql-general

From Igor Korot
Subject Re: [GENERAL] libpq confusion
Date
Msg-id CA+FnnTwZwcc4nQA=V-fjT+yP0pNCDztSZJTJCOnstzuAL2R2sQ@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] libpq confusion  (John R Pierce <pierce@hogranch.com>)
Responses Re: [GENERAL] libpq confusion  (John R Pierce <pierce@hogranch.com>)
List pgsql-general
Hi, John,

On Wed, Sep 20, 2017 at 12:02 PM, John R Pierce <pierce@hogranch.com> wrote:
> On 9/20/2017 6:30 AM, Igor Korot wrote:
>
> Hi, guys,
>
> On Wed, Sep 20, 2017 at 12:20 AM, Allan Harvey
> <allan.harvey@libertyonesteel.com> wrote:
>
> How do I properly check if the record exists from libpq?
>
> Igor,
> I use PQntuples() to check the number of ... tuples, for > 0
>
> I was actually curious - isn't it what "PGRES_COMMAND_OK" for?
> IIUC, this constant indicates successful query run, but no records was
> generated.
>
> Or am I missing something and I will have to check PQntuples()?
>
>
> a query that returns zero rows is still successful.

From the documentation:
https://www.postgresql.org/docs/9.1/static/libpq-exec.html

[quote]
PGRES_COMMAND_OK

Successful completion of a command returning no data.
[/quote]

No data = no rows, right?

Thank you.


>
> --
> john r pierce, recycling bits in santa cruz


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: George Neuner
Date:
Subject: Re: [GENERAL] VM-Ware Backup of VM safe?
Next
From: John R Pierce
Date:
Subject: Re: [GENERAL] libpq confusion