Handling memory contexts in aggregate function invoking other built-in aggregate functions

2021-12-03 Thread Matt Magoffin
I am trying to see if I can write a C aggregate function that operates on numeric[] array columns, and essentially performs aggregates on the array elements as if they were individual columns, resulting in an output numeric[] array with the aggregate element values. I do realise I can use

Re: Insert binary file into bytea where PG server does not have access to the file ?

2021-12-03 Thread Adrian Klaver
On 12/3/21 12:42, David Gauthier wrote: Please reply to list also. Ccing list Ya, perl, how about perl ? That would depend on what Perl database driver you are using. Assuming DBD::Pg: https://metacpan.org/pod/DBD::Pg Then search on binary. Folks with Perl experience can provide more

Re: Insert binary file into bytea where PG server does not have access to the file ?

2021-12-03 Thread Adrian Klaver
On 12/3/21 12:13, David Gauthier wrote: 11.5 on linux Big corp with an IT dept providing us with PG DBs running in instances on their servers. (We/I amd not DBA).    We on the client side, the "users" of these DBs, want to load binary files into bytea type columns.  But the files we want to

Re: libpq: Which functions may hang due to network issues?

2021-12-03 Thread Daniel Frey
> On 3. Dec 2021, at 18:14, Tom Lane wrote: > > Daniel Frey writes: >>> On 3. Dec 2021, at 17:00, Laurenz Albe wrote: >>> On Fri, 2021-12-03 at 11:37 +0100, Daniel Frey wrote: Is there a complete list of methods that might wait for network communication? > >>> No; you have to read

Insert binary file into bytea where PG server does not have access to the file ?

2021-12-03 Thread David Gauthier
11.5 on linux Big corp with an IT dept providing us with PG DBs running in instances on their servers. (We/I amd not DBA).We on the client side, the "users" of these DBs, want to load binary files into bytea type columns. But the files we want to load are on disks that the server does not

Re: libpq: Which functions may hang due to network issues?

2021-12-03 Thread Tom Lane
Daniel Frey writes: >> On 3. Dec 2021, at 17:00, Laurenz Albe wrote: >> On Fri, 2021-12-03 at 11:37 +0100, Daniel Frey wrote: >>> Is there a complete list of methods that might wait for network >>> communication? >> No; you have to read the code. > I feel that this is insufficient, as the

Re: SUM() of INTERVAL type produces INTERVAL with no precision

2021-12-03 Thread Sebastien Flaesch
My bad, sorry. RTFM Seb. Seb From: Adrian Klaver Sent: Friday, December 3, 2021 5:30 PM To: Sebastien Flaesch ; Tom Lane Cc: pgsql-general Subject: Re: SUM() of INTERVAL type produces INTERVAL with no precision EXTERNAL: Do not click links or open attachments

Re: SUM() of INTERVAL type produces INTERVAL with no precision

2021-12-03 Thread Adrian Klaver
On 12/3/21 08:12, Sebastien Flaesch wrote: Hum test1=> create table tab2 ( i interval hour to minute ); CREATE TABLE test1=> insert into tab2 values ( interval '-10 555 11:22:33' ); INSERT 0 1 test1=> select * from tab2;                   i --  

Re: Max connections reached without max connections reached

2021-12-03 Thread Dmitry Dolgov
> On Fri, Dec 03, 2021 at 10:32:03AM -0500, Tom Lane wrote: > Dilip Kumar writes: > > On Thu, Dec 2, 2021 at 9:35 AM Dilip Kumar wrote: > >> I think there is no such view or anything which tells about which > >> backend or transaction has more than 64 sub transaction. But if we > >> are ready

Re: libpq: Which functions may hang due to network issues?

2021-12-03 Thread Daniel Frey
> On 3. Dec 2021, at 17:00, Laurenz Albe wrote: > > On Fri, 2021-12-03 at 11:37 +0100, Daniel Frey wrote: >> I need to know which functions of libpq may "hang", depending on network >> issues. For some functions is >> seems to be clear, as they only work locally, other functions are clearly >>

Re: SUM() of INTERVAL type produces INTERVAL with no precision

2021-12-03 Thread Sebastien Flaesch
Hum test1=> create table tab2 ( i interval hour to minute ); CREATE TABLE test1=> insert into tab2 values ( interval '-10 555 11:22:33' ); INSERT 0 1 test1=> select * from tab2; i -- years 10 mons 555 days 11:22:00 (1 row)

Re: SUM() of INTERVAL type produces INTERVAL with no precision

2021-12-03 Thread Sebastien Flaesch
Hi Tom, I do care because I wrote a database driver/interface that needs to do automatic conversions from native PostgreSQL types, to our programming language types (we sell a compile/runtime system). I need introspection of the fetched data. The more exact type info I get, the better. As

Re: libpq: Which functions may hang due to network issues?

2021-12-03 Thread Laurenz Albe
On Fri, 2021-12-03 at 11:37 +0100, Daniel Frey wrote: > I need to know which functions of libpq may "hang", depending on network > issues. For some functions is > seems to be clear, as they only work locally, other functions are clearly > documented to wait on some > network interaction. But for

Re: Max connections reached without max connections reached

2021-12-03 Thread Tom Lane
Dilip Kumar writes: > On Thu, Dec 2, 2021 at 9:35 AM Dilip Kumar wrote: >> I think there is no such view or anything which tells about which >> backend or transaction has more than 64 sub transaction. But if we >> are ready to modify the code then we can LOG that information in >>

Re: SUM() of INTERVAL type produces INTERVAL with no precision

2021-12-03 Thread Tom Lane
Sebastien Flaesch writes: > When doing a SUM( ) aggregate on an INTERVAL HOUR TO SECOND(0) column, the > resulting type loses the interval type qualifiers... We don't generally attribute a typmod (which is what interval field specs are) to the output of any function, other than the ones that

Re: Require details that how to find user creation date in postgresql Database

2021-12-03 Thread Achilleas Mantzios
On 2/12/21 11:51 π.μ., Sonai muthu raja M wrote: Dear Team, Kindly help us to provide the details that how to find User creation date in postgresql Database. Note: we know that we can find the create user query from postgresql log. Apart from that how to find it from inside the Database

SUM() of INTERVAL type produces INTERVAL with no precision

2021-12-03 Thread Sebastien Flaesch
Hello! When doing a SUM( ) aggregate on an INTERVAL HOUR TO SECOND(0) column, the resulting type loses the interval type qualifiers... Obviously one can cast the SUM() to get the original type back, but I was wondering if there is a simpler way to handle this, to not force programmers to add

libpq: Which functions may hang due to network issues?

2021-12-03 Thread Daniel Frey
I need to know which functions of libpq may "hang", depending on network issues. For some functions is seems to be clear, as they only work locally, other functions are clearly documented to wait on some network interaction. But for some functions, it is unclear on whether they are guaranteed

Re: Max connections reached without max connections reached

2021-12-03 Thread Dilip Kumar
On Thu, Dec 2, 2021 at 9:35 AM Dilip Kumar wrote: > I think there is no such view or anything which tells about which > backend or transaction has more than 64 sub transaction. But if we > are ready to modify the code then we can LOG that information in > GetNewTransactionId(), when first time