Dynamic SQL - transition from ms to pg - Mailing list pgsql-general

From Erik Darling
Subject Dynamic SQL - transition from ms to pg
Date
Msg-id CAO+EYwKZ9DUn_NUzwVL5mGMV7NKHKQbVakuAuUsKcYiHLRjGMA@mail.gmail.com
Whole thread Raw
Responses Re: Dynamic SQL - transition from ms to pg  (Michael Paquier <michael.paquier@gmail.com>)
Re: Dynamic SQL - transition from ms to pg  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-general

Hi,

I've been developing for MS SQL around four years. I'm starting out with some work in Postgresql next week, and I'd like to know if there's any equivalent way to do something like this (from my word press)

http://sqldriver.wordpress.com/2013/12/09/generating-inserts-dynamically/

My question is mainly about creating comma delimited column names as variables and executing dynamic SQL with them. I've spent some time trying to find an answer and I seem to keep running into the same few stack questions.

Any advice is appreciated. I think I'm going to end up needing dynamic queries like what I've written for similar tasks moving data from files to staging tables and then to a larger set of data warehouse tables and setting up either views (perhaps materialized?) or more tables for reporting.

Thanks,
Erik

pgsql-general by date:

Previous
From: Keith Fiske
Date:
Subject: Re: Planning error in dynamic string creation in plpgsql
Next
From: Michael Paquier
Date:
Subject: Re: Dynamic SQL - transition from ms to pg