Re: The tragedy of SQL

2021-09-17 Thread Benedict Holland
I love how we would admonish sql but love lisp. There isn't a perfect language. SQL is fine. C is damn good. C++ is impossible, Java is C++ but simple, Python is a C wrapper. God help us if we settled on Fortran. We would still have single core processors. Lisp at least allowed multithreading but i

Re: The tragedy of SQL

2021-09-17 Thread Gavin Flower
On 17/09/21 23:49, Raymond Brinzer wrote: On Tue, Sep 14, 2021 at 9:06 AM Merlin Moncure wrote: I've long thought that there is more algebraic type syntax sitting underneath SQL yearning to get out. I wanted to come back to this, because I've been looking to take a single problem (from my pers

Re: Fwd: autocommit for multi call store procedure

2021-09-17 Thread Adrian Klaver
On 9/16/21 6:32 PM, Trang Le wrote: Hi Adrian, I am processing this issue with Ninad. Could you double check it? I have no idea what the forwarded message was showing. Too many changes in code. As David suggested reduce this down to a simple test case that demonstrates your issue. Regar

Re: pg_upgrade problem as locale difference in data centers

2021-09-17 Thread Tom Lane
Yi Sun writes: > update pg_database set datcollate='en_US.UTF-8', datctype='en_US.UTF-8' > where datname in ('postgres','template1','template0') and > (datcollate<>'en_US.UTF-8' or datctype<>'en_US.UTF-8') This seems like a pretty bad idea. You might get away with it if you've not added any user

Re: jsonb Indexing

2021-09-17 Thread Julien Rouhaud
Hi, On Fri, Sep 17, 2021 at 9:55 PM wrote: > > I was wondering what I'm doing wrong. There are steps what I've tried: > > CREATE TABLE api ( > jdoc jsonb > ); > > INSERT INTO api (jdoc) > VALUES ('{ > "guid": "9c36adc1-7fb5-4d5b-83b4-90356a46061a", > "name": "Angela Barton", >

Re: SELECT FOR UPDATE returns zero rows with CTE

2021-09-17 Thread Tom Lane
Alban Hertroys writes: >> On 17 Sep 2021, at 8:32, Roman Guryanov >> wrote: >> Why does SELECT FOR UPDATE return 0 rows in the scenario below? (execution >> in transaction) > Most likely the outer select returns 0 rows because you locked the rows you > expected in cte2 and didn’t perform an u

jsonb Indexing

2021-09-17 Thread ramikvl
Hello, I'm new to jsonb feature of postgres. I have PostgreSQL 13.2 running locally in docker. I've been playing a little bit with jsonb indexes described https://www.postgresql.org/docs/13/datatype-json.html#JSON-INDEXING and I'm not able make the GIN index work on 'tags'. I was wondering

Re: The tragedy of SQL

2021-09-17 Thread Tom Browder
On Fri, Sep 17, 2021 at 06:49 Raymond Brinzer wrote: On Tue, Sep 14, 2021 at 9:06 AM Merlin Moncure wrote: > > I've long thought that there is more algebraic type syntax sitting > > underneath SQL yearning to get out. ... > Now, if this sort of thing suits the way you think, I say, "Great!" > I'm

Re: The tragedy of SQL

2021-09-17 Thread Raymond Brinzer
On Fri, Sep 17, 2021 at 7:49 AM Raymond Brinzer wrote: > Now, if this sort of thing suits the way you think, I say, "Great!" > I'm glad you have a language which suits you. Reading this over, I realized I should have been more clear: I mean "you" generally. I liked your comment about algebraic

Re: The tragedy of SQL

2021-09-17 Thread Raymond Brinzer
On Tue, Sep 14, 2021 at 9:06 AM Merlin Moncure wrote: > I've long thought that there is more algebraic type syntax sitting > underneath SQL yearning to get out. I wanted to come back to this, because I've been looking to take a single problem (from my perspective) and explain it concisely. Your

Re: The tragedy of SQL

2021-09-17 Thread Raymond Brinzer
On Wed, Sep 15, 2021 at 2:46 AM Julien Rouhaud wrote: > I agree, and actually sent a patch some time ago to allow usage of > third-party parser(s). They can coexist with the core one, meaning > that you can (if you write your parser this way) use both languages, > even in a multi-query string. S

Re: SELECT FOR UPDATE returns zero rows with CTE

2021-09-17 Thread Alban Hertroys
> On 17 Sep 2021, at 8:32, Roman Guryanov wrote: > > Hello, could you check my problem. > Why does SELECT FOR UPDATE return 0 rows in the scenario below? (execution in > transaction) > > If delete 'FOR UPDATE', 1 row returned > > Test case: > DROP TABLE IF EXISTS > t1; > > CREATE TABLE t1

SELECT FOR UPDATE returns zero rows with CTE

2021-09-17 Thread Roman Guryanov
Hello, could you check my problem. Why does SELECT FOR UPDATE return 0 rows in the scenario below? (execution in transaction) If delete 'FOR UPDATE', 1 row returned Test case: DROP TABLE IF EXISTS t1;DROP TABLE IF EXISTS t2;CREATE TABLE t1 (_pk serial, t1c1 integer, t1c2 integer, t1c3 text);CREA