Re: How to update a table with the result of deleting rows in another table

2020-10-05 Thread Pankaj Jangid
On Tue, Oct 06 2020, Hemil Ruparel wrote: > with data as ( > delete from orders > where customer_id = > and date = '2020-10-05' returning price > ), total as ( > select sum(price) from data > ) > update paymentdetail > set temp_credit = temp_credit + (select * from total) > w

Re: Storing a time interval

2019-11-08 Thread Pankaj Jangid
ypically you need to surround the outer column in brackets - e.g. > (dates).discount_last_date. If you are using an ORM library, does it know > how to deal with that? > I faced a similar issue when using Enums with with rust lang. The Diesel ORM didn't support it directly. Had to stru

Using PostgreSQL for Machine Learning Data Pipelines

2019-10-17 Thread Pankaj Jangid
PostgreSQL is deployed for ML use. Any pointers referring to study material will be helpful. Please share in this thread. -- Thanks & Regards, Pankaj Jangid

Re: PG 12 not yet for mac

2019-10-07 Thread Pankaj Jangid
Tomas Vondra writes: > On Mon, Oct 07, 2019 at 11:11:43AM -0400, Ravi Krishna wrote: >>https://postgresapp.com/downloads.html >> >>The link which says PG 12 is actually PG 11. >> > > Not sure if the link is correct or not (it seems to point to > Postgres-2.3-12.dmg, which seems like it might be v

Re: PG11 Parallel Thanks!!

2019-10-02 Thread Pankaj Jangid
user story. Thanks for sharing your experience, Jason. -- Pankaj Jangid

A post describing PostgreSQL 12 Generated Columns

2019-10-02 Thread Pankaj Jangid
Found a very nice article about PostgreSQL 12 Generated Columns. I thought this might be useful for everyone. Hence sharing. https://pgdash.io/blog/postgres-12-generated-columns.html -- Pankaj Jangid

Re: managing primary key conflicts while restoring data to table with existing data

2019-09-26 Thread Pankaj Jangid
ng pkey 3. remove pkey references and the columns 4. make UUID column the pkey 5. remove old pkey column. -- Pankaj Jangid

Re: How to represent a bi-directional list in db?

2019-09-24 Thread Pankaj Jangid
sco. Got the idea. -- Pankaj Jangid

Re: How to represent a bi-directional list in db?

2019-09-23 Thread Pankaj Jangid
in a table. I got the idea. I'll add another column in the processes table which points to the first stage (first_stage_id). And quries Forward pass: 1. select name from stages where id = 2. select name from stages where prev_id = 3. repeat (2) Backward pass: 1. select name from stages where prev_id = 2. select name from stages where id = 3. repeat (2) This is assuming I also create a circular list. I can also store last_stage_id in the process table if we don't want to create circular list in db. Regards. -- Pankaj Jangid

Re: How to represent a bi-directional list in db?

2019-09-22 Thread Pankaj Jangid
Francisco Olarte writes: > On Sun, Sep 22, 2019 at 4:25 PM Pankaj Jangid wrote: >> CREATE TABLE stages ( >>id SERIAL PRIMARY KEY, >>name VARCHAR(80) NOT NULL, >>created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, >>upda

How to represent a bi-directional list in db?

2019-09-22 Thread Pankaj Jangid
"prev_stage_id" of table "stages" Is it not possible to create "nullable" self referencing foreign keys? -- Pankaj Jangid