Re: Postgresql range_agg() Return empty list

2024-07-10 Thread Paul A Jungwirth
On Wed, Jul 10, 2024 at 6:37 PM Han Tang wrote: > I am using range_agg() function, it works fine with original table value > > But when I try to do some update for range value, it will give back an empty > list > > Select range_agg(b.r) > From ( > Select int8range(lower(bin_range)+1, upper(bin_

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Paul A Jungwirth
On Tue, Feb 25, 2020 at 2:18 AM Stanislav Motyčka wrote: > Sometimes (for tables with many columns) it would be better and easier to > write "SELECT" statement with clause "EXCEPT": > "SELECT * [EXCEPT col1 [,col2]] FROM ..." I've wanted this feature lots of times and would be delighted to see i

Rules documentation example

2019-11-11 Thread Paul A Jungwirth
Hello, I'm reading the docs about the Postgres Rule system here: https://www.postgresql.org/docs/12/rules-views.html That page says: > It turns out that the planner will collapse this tree into a two-level query > tree: the bottommost SELECT commands will be “pulled up” into the middle > SELE

Re: jsonb_set() strictness considered harmful to data

2019-10-20 Thread Paul A Jungwirth
> That said, I think it is reasonable that a PostgreSQL JSON function > behaves in the way that JSON users would expect, so here is my +1 for > interpreting an SQL NULL as a JSON null in the above case Just to chime in as another application developer: the current functionality does seem pretty su

Re: When does Postgres use binary I/O?

2019-09-22 Thread Paul A Jungwirth
On Sun, Sep 22, 2019 at 11:53 AM Tom Lane wrote: > I thought of an easier-to-maintain approach to that part than having > a reference file. Binary send functions are invokable from SQL, > so we could just imagine adding test cases along the lines of > > regression=# select int8send(42); > i

When does Postgres use binary I/O?

2019-09-17 Thread Paul A Jungwirth
Hello, I've read the docs at [1] and also this interesting recent post about adding binary I/O to the hashtypes extension. I wrote send & recv functions for my new multirange types, but I'm not sure how to test them. After running installcheck or installcheck-world, the code coverage report says t

Re: Work hours?

2019-08-27 Thread Paul A Jungwirth
On Tue, Aug 27, 2019 at 3:27 PM stan wrote: > I need to write a function that, given a month, and a year as input returns > the "work hours" in that month. In other words something like > > 8 * the count of all days in the range Monday to Friday) within that > calendar month. This gives you all t

Re: flinfo NULL in DirectFunctionCall callee?

2019-08-26 Thread Paul A Jungwirth
On Mon, Aug 26, 2019 at 8:12 AM Tom Lane wrote: > > Paul A Jungwirth writes: > > Is it expected for flinfo to be null when using DirectFunctionCall*? > > Yes, per the comment on those functions: > > * These are for invocation of a specifically named function with

flinfo NULL in DirectFunctionCall callee?

2019-08-26 Thread Paul A Jungwirth
Hello, I'm writing a multirange_cmp function which calls range_cmp to compare individual elements. It looks like this: cmp = DatumGetInt32(DirectFunctionCall2( range_cmp, RangeTypePGetDatum(r1), RangeTypePGetDatum(r2))); But I get a segfault when range_cmp tries to reach

Re: How to split an array into columns

2018-08-24 Thread Paul A Jungwirth
On Fri, Aug 24, 2018 at 2:01 AM, a <372660...@qq.com> wrote: > > Say if I have an float8 array: > > id| data > --|--- > a | {1,2} > b | {2,4} > > . . . > > Since I would have around 200,000 rows, I would prefer it having enough > capacity to carry out the calculation such as sum(). Is

Re: User-defined function with anyrange[]

2018-07-08 Thread Paul A Jungwirth
> you can use overloading to define > several functions of the same name, and just write out one for each > range type you actually need this functionality for. Thanks! I was hoping to avoid that, but it's what I wound up doing after all, as you can see here: https://github.com/pjungwir/range_agg

User-defined function with anyrange[]

2018-07-05 Thread Paul A Jungwirth
Hello, I want to make an aggregate function range_agg(anyrange) that returns anyrange[]. But when I try to define it, Postgres tells me it doesn't know what an anyrange[] is. I get this error: ERROR: type anyrange[] does not exist I also tried taking an anyrange and returning an anyarray, which

Re: Using AWS ephemeral SSD storage for production database workload?

2018-01-29 Thread Paul A Jungwirth
> I have come across some ideas on the Internet > where people hinted at running production PostgreSQL workloads > on AWS ephemeral SSD storage. I think people were more serious about that before AWS introduced PIOPS. I wouldn't do this unless I had streaming replication to a standby, plus regular

Temporal Foreign Keys

2017-12-28 Thread Paul A Jungwirth
Since there have been a couple threads on the hackers list about temporal features [1, 2], I thought I'd share an extension I've been writing for temporal foreign keys: https://github.com/pjungwir/time_for_keys There is a big test suite, but right now it is still basically a proof-of-concept, res