Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j7bsk-0007pZ-7y for pgsql-docs@arkaria.postgresql.org; Fri, 28 Feb 2020 09:24:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7bsj-0004hX-1N for pgsql-docs@arkaria.postgresql.org; Fri, 28 Feb 2020 09:24:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j7bsi-0004hQ-Lz for pgsql-docs@lists.postgresql.org; Fri, 28 Feb 2020 09:24:28 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j7bsf-0005vG-R1 for pgsql-docs@lists.postgresql.org; Fri, 28 Feb 2020 09:24:28 +0000 Received: by mail-wr1-x441.google.com with SMTP id j16so2140214wrt.3 for ; Fri, 28 Feb 2020 01:24:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=dqmf/D5N4N1FDpEAYTCbps2UXQmccyNR5Dh4hMH+LDw=; b=eQVNkZWeuMMeVe7Ui7lWpLWxobpP9CKxwAsPwMbCPE92T43xld+mYDW7ibBteNVtuU +PThsDSQYJ+wb+NCxe6iY1UzB2ebrz3phG5+kht3Km+Wg1UGrL/oGA7YXktEEPWMu18T +3CuRdUgoE5lyIiQvVVQQhpVCjD6GXgVhUNJ19/M611A2RtOS5byBVqp1kLn/wSc7zGh sNi3NMQP2nOtawrKGDbMG1kiycwe9QUTn65NRclq+fBBZLuQ0G+v/ijAzVYTuP6/mVWn oMOPGU7p8SLfR67p6vHzp2CQHCBw8RAv/vvn9A5ze1dpNcvtHKmSKXOBfddBZuwXZNkw HDxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=dqmf/D5N4N1FDpEAYTCbps2UXQmccyNR5Dh4hMH+LDw=; b=XncM3EfOGqUuuj85vV9hSh1xAxMcvnJA7oP/7Z0sXX+bf7ryEJkQ272ruqdLndQwW2 K2r7lr2VmlPuGe+R0gk03KITHmM2Gn1eAwSkyxT/JJqwSAXEB9oHcsksF/i5jeCPH9/m MeJPgfAq5vncPPX4qx7V0oHjs8+1GTt253GkNMwLtkSkM4w3UqbCU8AJttc/U+8jJtUQ RYz/T8FjLyxNbrGXL5qZopW1tUeODjODspmoZsmcoWpGDfsSfkWt/5jgkXTbGLX/eF0i FAFZ/yHAFGLTptEhsIHif0GdsDwPjNBb2/tWlehLVl/2AW7/+oJyuIdMv0yXId9HmpoH WH4w== X-Gm-Message-State: APjAAAVAstCKySgKXP0FAX8qvvw++hsdUtM3gc0n3l6GwTsK9pHEPZ+b JtGAAYAhctooGeoxuo8sJBKxuA== X-Google-Smtp-Source: APXvYqyva+jk2wf3ezE+YMCqOU+/t0ziUI9biYy2/90Vcxe7/BW9zvVy4kOdW9WC4VmJc432xbf8Pg== X-Received: by 2002:adf:f1cb:: with SMTP id z11mr3817092wro.375.1582881864948; Fri, 28 Feb 2020 01:24:24 -0800 (PST) Received: from localhost.localdomain (217-149-172-164.nat.highway.telekom.at. [217.149.172.164]) by smtp.gmail.com with ESMTPSA id c4sm1346743wml.7.2020.02.28.01.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 01:24:24 -0800 (PST) Message-ID: <1fab9e57c5d715a1d344b03d137ef7c6d7ec7513.camel@cybertec.at> Subject: Re: thoroughly broken examples on the Dynamic SQL page From: Laurenz Albe To: jacquesdereims@gmail.com, pgsql-docs@lists.postgresql.org Date: Fri, 28 Feb 2020 10:24:23 +0100 In-Reply-To: <158281875655.30439.3164486065108716610@wrigleys.postgresql.org> References: <158281875655.30439.3164486065108716610@wrigleys.postgresql.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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