Re: Query regarding managing Replication

2023-07-03 Thread Ashok Patil
Hello Julien,

I am able to perform replication of a single machine where primary and
stand-by are on same localhost..
I think you are right.. it might be blocking the backup process by
firewall..

Just one signal question: is multi-master replication possible on Postgres?
I searched on google.. but did not find a proper solution..

If it is possible, then can you please share a link where I can get that
information..

Thanks in advance.

Regards,
Ashok Patil

On Fri, Jun 30, 2023 at 2:02 PM Julien Rouhaud  wrote:

> Hi,
>
> On Fri, Jun 30, 2023 at 01:47:29PM +0530, Ashok Patil wrote:
> > Hello MAZIÈRE,
> >
> > I tried update by
> >
> > listen_addresses = '*'   and listen_addresses = 'server_address' but
> still
> > i am getting same error.
>
> Did you restart postgres after changing listen_addresses, and is the
> primary
> port 5432?
>
> If yes and if you still get the same connection errors, it mean that
> either the
> primary IP is wrong or something is blocking the traffic between the two
> machines (like a firewall).
>


Re: Query regarding managing Replication

2023-07-03 Thread Julien Rouhaud
Hi,

On Mon, Jul 03, 2023 at 02:07:54PM +0530, Ashok Patil wrote:
>
> I am able to perform replication of a single machine where primary and
> stand-by are on same localhost..
> I think you are right.. it might be blocking the backup process by
> firewall..

Agreed

> Just one signal question: is multi-master replication possible on Postgres?
> I searched on google.. but did not find a proper solution..

This is not possible with vanilla postgres.  There are some commercial products
/ postgres forks that implement it, but I've never used them so I can't comment
on how well they work nor how much they cost.




Re: [Beginner Question] How to print the call link graph?

2023-07-03 Thread Wen Yi
OK, that helps me a lot.
I just want to get the trace of function call.
Thanks very much!


Yours,
Wen Yi

[Beginner Question]What's the use of ResTarget?

2023-07-03 Thread Wen Yi
Hi community
When I read the Internals document (41.1. The Query Tree),
the introduction of  the 'the result relation' confuse me.


In the document, it says


> This is an index into the range table that identifies the relation where 
the results of the query go.


And I cheak the corresponding code:



In parsenodes.h (A part)



typedef struct ResTarget
{
    NodeTag        type;
    char       *name;    
        /* column name or NULL */
    List       
*indirection;    /* subscripts, field names, and '*', or NIL */
    Node       *val;    
        /* the value expression to compute or 
assign */
    int            
location;        /* token location, or -1 if 
unknown */
} ResTarget;


In gram.y (A part)


insert_column_item:
        ColId opt_indirection
            {
            
    $$ = makeNode(ResTarget);


My question is:


I really don't the the use of ResTarget, in my original understand, I guess the 
use of ResTarget is to store the columns of the result, like:


SELECT row_1, row_2 FROM table;


After the parse, the ResTarget will store the row_1, row_2 in the ResTarget.



But the turth is, it also be used in the another clause, like INSERT, far from 
what I imagined.
So what's the use of ResTarget?



Can someone give me some advice?
Thanks in advance!


Yours,
Wen Yi

Re: psql and pgpass.conf on Windows

2023-07-03 Thread Kirk Wolak
On Sat, Jul 1, 2023 at 2:07 AM Julien Rouhaud  wrote:

> On Sat, Jul 01, 2023 at 01:40:49AM -0400, Kirk Wolak wrote:
> >
> > FWIW, I discovered that psql is case sensitive on the dbname, without
> > quoting it!
>
> That's on purpose, since shell quoting behavior is entirely different from
> SQL.
> The quotes are discarded by the shell, so it would otherwise require users
> doing something like
>
> psql -d '"MyDbName"'
>
> The behavior is the same for all client tools, and other object arguments
> like
> username.
>

Thanks,
  I was mentioning it in case the person who could not figure out why his
pgpass.conf was not being hit correctly,
might have multiple things colluding against them.

  It's nice to know it is consistent, and applies to usernames.