Re: Issue with pgstattuple on Sequences in PostgreSQL

2024-06-25 Thread Ayush Vatsa
>  I agree it’s a documentation bug
Thanks for confirmation, then maybe I can start a new thread in
pgsql-hackers about this bug and I can myself create a patch for the same.

> then the regression test should be fixed as well
I will add regress test for sequences as well.

We can remove *SEQUENCE* from
https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L255-L259

as well so that users can encounter *ERRCODE_FEATURE_NOT_SUPPORTED*.

Thanks
Ayush Vatsa
SDE AWS


Re: Postgresql python in upgraded version 16.2

2024-06-25 Thread Adrian Klaver

On 6/21/24 00:33, Šika Michal wrote:

Hello,
I get the install packages from this repository:
https://download.postgresql.org/pub/repos/yum/16/redhat/rhel-8.9-ppc64le/ 



I would go here:

https://yum.postgresql.org/contact/

and use the Issue Tracker link.

You will need to set up a Postgres community account to access the 
tracker. Clicking on the link will guide you through the process.





Michal


--
Adrian Klaver
adrian.kla...@aklaver.com





Can any_value be used like first_value in an aggregate?

2024-06-25 Thread Bruno Wolff III

For example, is output of 10 guaranteed in the following:
bruno=> select any_value(x order by x desc) from generate_series(1,10) as x;
any_value 
---

   10
(1 row)

The use case is that I want to return a value of one column that is paired 
with the maximum value of another column in each group when using GROUP BY.


(There aren't going to be any NULLs in the involved columns.)

Thanks.




Re: Can any_value be used like first_value in an aggregate?

2024-06-25 Thread Tom Lane
Bruno Wolff III  writes:
> For example, is output of 10 guaranteed in the following:
> bruno=> select any_value(x order by x desc) from generate_series(1,10) as x;
>  any_value 
> ---
> 10
> (1 row)

Not really.  It will work that way in simple cases, but I think the
behavior stops being predictable if the input gets large enough to
induce the planner to use parallel aggregation.  In any case, the
example shown isn't amazingly efficient since it'll still perform
a sort to meet the ORDER BY spec.

> The use case is that I want to return a value of one column that is paired 
> with the maximum value of another column in each group when using GROUP BY.

Use window functions (i.e. first_value).  This is what they're for,
and they are smart enough to do just one sort for functions sharing
a common window spec.

regards, tom lane




Replication After manual Failover

2024-06-25 Thread Yongye Serkfem
Hello Engineer,
Below is the error message I am getting after failing over to the standby
and reconfiguring the former master as the new standby. Any help will be
appreciated.
[image: image.png]


Re: Replication After manual Failover

2024-06-25 Thread Muhammad Ikram
Hi,

Please reinitialize using pg_basebackup or use pg_rewind



Muhammad Ikram
Bitnine Global


On Tue, 25 Jun 2024 at 22:20, Yongye Serkfem  wrote:

> Hello Engineer,
> Below is the error message I am getting after failing over to the standby
> and reconfiguring the former master as the new standby. Any help will be
> appreciated.
> [image: image.png]
>


Re: Replication After manual Failover

2024-06-25 Thread Ron Johnson
On Tue, Jun 25, 2024 at 2:39 PM Muhammad Ikram  wrote:

> Hi,
>
> Please reinitialize using pg_basebackup
>

Might not be possible during a switchover.


> or use pg_rewind
>
>
>
> Muhammad Ikram
> Bitnine Global
>
>
> On Tue, 25 Jun 2024 at 22:20, Yongye Serkfem  wrote:
>
>> Hello Engineer,
>> Below is the error message I am getting after failing over to the standby
>> and reconfiguring the former master as the new standby. Any help will be
>> appreciated.
>>
>> [snip]


Re: Replication After manual Failover

2024-06-25 Thread Ron Johnson
How were you replicating?

What was the status of the replication?

On Tue, Jun 25, 2024 at 1:20 PM Yongye Serkfem  wrote:

> Hello Engineer,
> Below is the error message I am getting after failing over to the standby
> and reconfiguring the former master as the new standby. Any help will be
> appreciated.
> [image: image.png]
>


Re: PostgreSQL Community Enquire !

2024-06-25 Thread Adrian Klaver

On 6/25/24 12:00, madhav sira wrote:

Hi Team,

Just wanted to reconfirm, for any queries or discussion on postgres 
coding/peformance tuning related questions, I have email to ( 
pgsql-gene...@postgresql.org ) and 
discussion will continue on emails only but  not any thing a forum 
platform something below i saw for Oracle in screenshot. If there is any 
such for postgres can you help me out.
I checked on postgres community all I saw was writing an email to ( 
pgsql-gene...@postgresql.org ) not 
any specific platform.


Just ask the question.



--
Adrian Klaver
adrian.kla...@aklaver.com





Re: Can any_value be used like first_value in an aggregate?

2024-06-25 Thread Bruno Wolff III

On Tue, Jun 25, 2024 at 13:08:45 -0400,
 Tom Lane  wrote:


Not really.  It will work that way in simple cases, but I think the
behavior stops being predictable if the input gets large enough to
induce the planner to use parallel aggregation.  In any case, the
example shown isn't amazingly efficient since it'll still perform
a sort to meet the ORDER BY spec.


Thanks.


The use case is that I want to return a value of one column that is paired
with the maximum value of another column in each group when using GROUP BY.


Use window functions (i.e. first_value).  This is what they're for,
and they are smart enough to do just one sort for functions sharing
a common window spec.


If I do that, I'd need to do it as a subselect inside of a group by. I'm 
thinking distinct on may work and be a better way to do it. The actual 
use case is a set of tripplets returned from a query, where I want on 
row for each distinct value in the first column, paired with the value 
in the second column, for which the third column is the largest. The 
second and third columns are effectively dependent on each other, so there 
won't be any ambiguity.


Thanks for getting me thinking about some other ways to approach the problem.