Re: facing problem in outparameters in c

2020-10-28 Thread Laurenz Albe
On Wed, 2020-10-28 at 04:57 +, Mahesh Bodepati wrote:
> Actually i am calling a postgres function by using c language  which  
> description
>  is defined in database side .when iam calling a postgres function by passing 
> input
>  and output parameters after excution of function in database side i need 
> output
> data in correcsponding  output parameters but iam not getting output like 
> that.

Right; output parameters in a function are columns in the result set.

>  i am getting total output data in response pointer.if iam getting total data
>  in response pointer it is hard to figure out which data  is for which output 
> parameter.

No, that is very simple.  You can call PQfnumber on the result set to find which
position in the result set belongs to a certain parameter name.

See 
https://www.postgresql.org/docs/current/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO

>  can you please check once attached two text files.

I looked, and the C code is unreadable.
You seem to be mixing embedded SQL and libpq calls, which you shouldn't.
There is great value in a consistent indentation style.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com





Re: facing problem in outparameters in c

2020-10-28 Thread Matthias Apitz
El día miércoles, octubre 28, 2020 a las 04:57:12a. m. +, Mahesh Bodepati 
escribió:

> Actually i am calling a postgres function by using c language  which  
> description is defined in database side .when iam calling a postgres function 
> by passing input and output parameters after excution of function in database 
> side i need output  data in correcsponding  output parameters but iam not 
> getting output like that. i am getting total output data in response 
> pointer.if iam getting total data in response pointer it is hard to figure 
> out which data  is for which output parameter. can you please check once 
> attached two text files.
> 
> 

I'm hoping that you're not writing C as you write emails, top posted and
all in one single line. You should wrap mail around column 72.

Punchcards are your friend.

matthias

-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
Без книги нет знания, без знания нет коммунизма (Влaдимир Ильич Ленин)
Without books no knowledge - without knowledge no communism (Vladimir Ilyich 
Lenin)
Sin libros no hay saber - sin saber no hay comunismo. (Vladimir Ilich Lenin)




Re: facing problem in outparameters in c

2020-10-28 Thread Mahesh Bodepati
whatever you said is correct but actually what i want is whenever iam calling 
the  postgres function by passing input and output parameters  in c ,after 
execution of postgres function in database side they will  return output 
paramers .after that when i print the output variable name i need that output 
parameter value diretcly without differenciating  with column names.



Thanks & Regards,
Mahesh Bodepati
Software Engineer- Engineering
XIUS
INNOVATE . LEAD.
mahesh.bodep...@xius.com
http://www.xius.com





From: Laurenz Albe 
Sent: Wednesday, October 28, 2020 12:29 PM
To: Mahesh Bodepati ; 
pgsql-general@lists.postgresql.org 
Subject: Re: facing problem in outparameters in c

On Wed, 2020-10-28 at 04:57 +, Mahesh Bodepati wrote:
> Actually i am calling a postgres function by using c language  which  
> description
>  is defined in database side .when iam calling a postgres function by passing 
> input
>  and output parameters after excution of function in database side i need 
> output
> data in correcsponding  output parameters but iam not getting output like 
> that.

Right; output parameters in a function are columns in the result set.

>  i am getting total output data in response pointer.if iam getting total data
>  in response pointer it is hard to figure out which data  is for which output 
> parameter.

No, that is very simple.  You can call PQfnumber on the result set to find which
position in the result set belongs to a certain parameter name.

See 
https://www.postgresql.org/docs/current/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO

>  can you please check once attached two text files.

I looked, and the C code is unreadable.
You seem to be mixing embedded SQL and libpq calls, which you shouldn't.
There is great value in a consistent indentation style.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com



Re: Backup Restore from other node after switchover/failover

2020-10-28 Thread Sushant Pawar
Hi Dirk,

Yes, this will work fine. You can use the existing backup to restore it on
the new node and use the WAL archives from new node for the recovery
purpose. As a best practice, I would suggest setting the parameter
"recovery_target_timeline=latest" in your recovery command to ensure the
recovery happens along the latest timeline.

Regards
Sushant

On Wed, Oct 28, 2020 at 2:53 PM Dirk Krautschick <
dirk.krautsch...@trivadis.com> wrote:

> Hi,
>
>
>
> haven’t tested it yet but maybe I can get a quick answer here.
>
> We have discussed the following scenario.
>
>
>
> Few nodes as streaming replication cluster all in sync with taking backup
>
> only from one dedicated node. Now that node which is responsible for the
> backups
>
> goes down. For sure I have a full backup taken from that crashed node
>
> some time ago but now this node is gone and I have to take care for a
>
> restore for some reason.
>
>
>
> Am I able to make a full restore with that last backup from the offline
> node
>
> to any other still existing node with Recovering the archived WAL from the
> new
>
> selected node if I have activated archive_mode as “always”?
>
>
>
> Or is it strictly necessary to create a new full backup from the new node
>
> which is responsible for the backups after the failover or maybe after a
>
> Switchover, too?
>
>
>
> Thanks and best regards
>
>
>
> Dirk
>