Re: libpq confusion

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: libpq confusion
Date: 2017-09-20 17:34:04
Message-ID: CA+FnnTwZwcc4nQA=V-fjT+yP0pNCDztSZJTJCOnstzuAL2R2sQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, John,

On Wed, Sep 20, 2017 at 12:02 PM, John R Pierce <pierce(at)hogranch(dot)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(dot)harvey(at)libertyonesteel(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2017-09-20 17:42:08 Re: libpq confusion
Previous Message George Neuner 2017-09-20 17:19:10 Re: VM-Ware Backup of VM safe?