Re: TSQL To Postgres - Unpivot/Union All

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: Anthony Apollis <anthony(dot)apollis(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: TSQL To Postgres - Unpivot/Union All
Date: 2023-07-20 14:51:35
Message-ID: CAEzk6fcfXk_-UweJZ_hFWecDAs_0ECd27Q_r_=o1V78k5xBBuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Thu, 20 Jul 2023 at 15:28, Anthony Apollis <anthony(dot)apollis(at)gmail(dot)com> wrote:
> I am attaching my TSQL and Postgres SQL:

You're still missing some CREATEs, for example for temp_FieldFlowsFact.

Even assuming your columns list is correct, I would still (and as a
matter of habit) include the target column list in your INSERT
statements, if only to make your own life easier, but especially
because any later changes to the tables could end up shifting the
position of the columns.

Certainly it will be easier for anyone else trying to disentangle the SQL later.

As an aside, can you clarify whether you mean temporal tables (and are
you using a temporal tables extension)? Or should that read
"temporary"?

Geoff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2023-07-20 15:07:31 Re: Fwd: TSQL To Postgres - Unpivot/Union All
Previous Message Laurenz Albe 2023-07-20 14:48:19 Re: How to improve the performance of my SQL query?

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2023-07-20 15:07:31 Re: Fwd: TSQL To Postgres - Unpivot/Union All
Previous Message Anthony Apollis 2023-07-20 14:28:33 Fwd: TSQL To Postgres - Unpivot/Union All