Re: thoroughly broken examples on the Dynamic SQL page

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: jacquesdereims(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: thoroughly broken examples on the Dynamic SQL page
Date: 2020-02-28 09:24:23
Message-ID: 1fab9e57c5d715a1d344b03d137ef7c6d7ec7513.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, 2020-02-27 at 15:52 +0000, PG Doc comments form wrote:
> Has anyone tried the examples on the
> https://www.postgresql.org/docs/11/ecpg-dynamic.html Dynamic SQL page? The
> very first line in each example immediately throws a syntax error: "syntax
> error at or near "exec"". Could we get this updated or a bug fixed? I'm
> migrating from SQL Server and really need to know how to migrate dynamic SQL
> in existing code.

You are confused.
This page is about embedded SQL in C.

If you want to write a stored procedure or function that uses dynamic SQL,
read https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2020-02-28 14:50:58 Minor error
Previous Message Alvaro Herrera 2020-02-27 18:32:56 Re: 9.4. String Functions and Operators page does not document that encode adds line breaks