Re: Appetite for `SELECT ... EXCLUDE`?

2022-11-18 Thread Nikhil Benesch
Thanks for the pointers, Tom. Sorry my search didn't turn those up. On Fri, Nov 18, 2022 at 3:18 PM Tom Lane wrote: > > Nikhil Benesch writes: > > Both DuckDB and Snowflake, as of recently, support a nonstandard `EXCLUDE` > > clause in the SELECT list to allow excluding fiel

Appetite for `SELECT ... EXCLUDE`?

2022-11-18 Thread Nikhil Benesch
Both DuckDB and Snowflake, as of recently, support a nonstandard `EXCLUDE` clause in the SELECT list to allow excluding fields from a wildcard [0] [1]. Example from the DuckDB announcement [2]: SELECT * EXCLUDE (jar_jar_binks, midichlorians) FROM star_wars Is there any appetite for adding

Re: DELETE ... USING LATERAL

2021-10-07 Thread Nikhil Benesch
On Mon, Oct 4, 2021 at 3:21 PM Tom Lane wrote: > Not sure what to tell you about the state of the idea that the > target table could be re-specified in FROM/USING. I'm hesitant > to close the door on it permanently, because people do periodically > wish to be able to left-join the target to

Re: DELETE ... USING LATERAL

2021-10-04 Thread Nikhil Benesch
On Mon, Oct 4, 2021 at 1:48 PM Tom Lane wrote: > My mental model of these things is that the target table is cross-joined > to the additional tables as though by a comma in FROM [...] Mine as well. I just managed to dredge up some history here though. Turns out you explicitly disabled this

DELETE ... USING LATERAL

2021-10-04 Thread Nikhil Benesch
Is it intentional that LATERAL elements in a USING clause of a DELETE statement can't reference the table declared in the FROM clause? Here's a somewhat contrived example. Suppose I have a table with one jsonb column: create table int_arrays (int_array jsonb); insert into int_arrays

Re: split_part for the last element

2020-10-23 Thread Nikhil Benesch
On Fri, Oct 23, 2020 at 2:35 PM Tom Lane wrote: > > "David G. Johnston" writes: > > On Fri, Oct 23, 2020 at 8:47 AM Nikhil Benesch > > wrote: > >> Is there another option I'm missing? Would there be interest in > >> extending split part

Re: split_part for the last element

2020-10-23 Thread Nikhil Benesch
On Fri, Oct 23, 2020 at 2:21 PM David G. Johnston wrote: > I'm torn here because this would be the first usage of this concept in > PostgreSQL (I think). Yeah, I also have some qualms about this design in the context of Postgres. Particularly because Postgres allows arrays to begin at negative

Re: split_part for the last element

2020-10-23 Thread Nikhil Benesch
. * It is inefficient. When the strings are large reversing the strings is a silly waste of compute. On Fri, Oct 23, 2020 at 12:03 PM PALAYRET Jacques wrote: > > Hello, > > reverse(split_part(reverse('foo bar baz'), ' ', 1)) -> 'baz' > > Regards > > - Mail o

split_part for the last element

2020-10-23 Thread Nikhil Benesch
Hi, Suppose I need to split a string on a delimiter and select one of the resulting components. If I want a specific component counting from the start, that's easy: split_part('foo bar baz', ' ', 1) -> 'foo' But if I want the last component, I have several less-than-ideal options: 1.