Re: [GENERAL] libpq confusion

2017-09-22 Thread Thomas Delrue
On Wednesday, September 20, 2017 1:47:05 PM EDT Igor Korot wrote:
>Thx.
>So it is referring to the command not a "command returning no data". ;-)

assuming
create table t (c int);

select c from t;
- PQresultStatus(result) == PGRES_TUPLES_OK
- PQntuples(result) == number or rows returned (int)
insert into t(c)values(1);
- PQresultStatus(result) ==PGRES_COMMAND_OK
- PQcmdTuples(result) == "1" (note: char*)
insert into t(c)values(1) returning c;
- PQresultStatus(result) ==PGRES_TUPLES_OK
- PQntuples(result) == 1 (int)

>On Wed, Sep 20, 2017 at 1:42 PM, John R Pierce  wrote:
>> On 9/20/2017 10:34 AM, Igor Korot wrote:
>> >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?
>> 
>> from that same page, a bit farther down, clarifying the potentially
>> confusing wording.
>> 
>> If the result status is PGRES_TUPLES_OK, then the functions described below
>> can be used to retrieve the rows returned by the query. Note that a SELECT
>> command that happens to retrieve zero rows still shows PGRES_TUPLES_OK.
>> PGRES_COMMAND_OK is for commands that can never return rows (INSERT,
>> UPDATE,
>> etc.). A response of PGRES_EMPTY_QUERY might indicate a bug in the client
>> software.


signature.asc
Description: This is a digitally signed message part.


Re: [GENERAL] Can PG replace redis, amqp, s3 in the future?

2017-05-02 Thread Thomas Delrue
On April 30, 2017 1:37:02 PM GMT+02:00, "Thomas Güttler" 
 wrote:
>Is is possible that PostgreSQL will replace these building blocks in
>the future?
> 
> - redis (Caching)
> - rabbitmq (amqp)
> - s3 (Blob storage)

These are three very different sets of functionalities, each requiring a 
different approach.  I am curious as to why you are thinking about having a 
single piece of software that does these three very different things. 

>One question is "is it possible?", then next "is it feasible?"

Possible? Sure: p != 0
Probable? No
Desirable? No

>I think it would be great if I could use PG only and if I could
>avoid the other types of servers.

When you're holding a hammer, everything looks like a nail. But hammering 
screws doesn't get you very far.  Sometimes you need a screwdriver and on other 
days a glue gun...

>The benefit is not very obvious on the first sight. I think it will
>saves you
>time, money and energy only in the long run.
>
>What do you think?

Do one thing(*) and do that thing well. Don't try to be everything to everyone. 


--
Thomas
(Sent from my mobile device,  please forgive brevity or typos.)


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