Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruEf4-003lBz-5M for pgsql-general@arkaria.postgresql.org; Tue, 09 Apr 2024 16:49:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ruEf3-007vov-6e for pgsql-general@arkaria.postgresql.org; Tue, 09 Apr 2024 16:49:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruEeV-007q2C-9q for pgsql-general@lists.postgresql.org; Tue, 09 Apr 2024 16:48:55 +0000 Received: from mx0d-001a4c01.pphosted.com ([67.231.151.23]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruEeR-0022Yp-Tx for pgsql-general@lists.postgresql.org; Tue, 09 Apr 2024 16:48:53 +0000 Received: from pps.filterd (m0210020.ppops.net [127.0.0.1]) by mx0c-001a4c01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 439CaHMV002851; Tue, 9 Apr 2024 12:48:50 -0400 Received: from eur03-am7-obe.outbound.protection.outlook.com (mail-am7eur03lp2232.outbound.protection.outlook.com [104.47.51.232]) by mx0c-001a4c01.pphosted.com (PPS) with ESMTPS id 3xb24qkqvm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Apr 2024 12:48:49 -0400 (EDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NizuOkEeqAukvsyLuoZKJYg8Ju3OAGKG0rklUDqyf1HU23MehftoszvbUjQnJZriERvw0OUgBs8VNs9Ij22hKMStqrBK5tCkBEuVgXw94uZ/gZot0n6xKjck1/Ur0TItBdQID0ncoRitvc1n0FyldAa8qe/6+yJV9XbsvgKgeAk3X1DGobt0UY1b55w49Y4Kf9+Kd9ozdU/e0dAdDNRCDsIO8rczl9Xt2231qYXE036GopyuIV0wMUdMyzJtMnVCiYWlhHGrlAgI5j70YX/DLs8bt4xoReDcW/0NgGXSRdS6BhayOVjn1xwKM2sNgmW3o524jMIeSKWby0oMYqcwMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vy20UYiwymOzIPBbHnrJV9LCX8VuRk9QNYYy1bHyyH0=; b=D+cxmEbOqvrGYAyygOr6wOh8sXneRFl/hM86Ph1158Wjveq+H81QwKgCqq5z62sK2HkQDgbLJfRQ0cPAgauXyn/f3kQ+qPdw+USsO/LVryWMNEcK9LEtBlY5yeC9manV6V7dM5ZvRKsxdKBJjC+so8f2Y7/4fg2N6jxO5xdfkKTqqQGIZFJnWkThzv60JQcHRaG5dLQqvysRDBu3LTWqE1vEvIXNwGxTViMiRz0upcVZoHbvRHgH4327lp0fyUzaJVIjvW6I5wqe7U9lMNBLLzrs1+QaXfJHxIfJpIgLQr/SLQ0naDyyDgTh4UX1zyIwccVPMnNjH2rbr5slD2+YHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=4js.com; dmarc=pass action=none header.from=4js.com; dkim=pass header.d=4js.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ourvolaris.onmicrosoft.com; s=selector2-ourvolaris-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vy20UYiwymOzIPBbHnrJV9LCX8VuRk9QNYYy1bHyyH0=; b=kVNpGyOWHquSOj1L7LzA7q4jZs8FZeUymPqV3VlfyW5xDTvzZzqoiTnlM0prfeoCPTyNgUOmiDlzgRLyd6+gvAExNLeVSckbopPn3wyCCa8TEzwaCthwKo9YtSzsRU2pRxxhVIXRGYUzY/WsXtM9KEwaSjRuIR13KJ+AkBCAiHk= Received: from AM9P191MB1286.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:1f2::22) by GV2P191MB2334.EURP191.PROD.OUTLOOK.COM (2603:10a6:150:d5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.26; Tue, 9 Apr 2024 16:48:47 +0000 Received: from AM9P191MB1286.EURP191.PROD.OUTLOOK.COM ([fe80::9bff:92a5:2257:239c]) by AM9P191MB1286.EURP191.PROD.OUTLOOK.COM ([fe80::9bff:92a5:2257:239c%5]) with mapi id 15.20.7430.045; Tue, 9 Apr 2024 16:48:47 +0000 From: Sebastien Flaesch To: Tom Lane CC: pgsql-general Subject: Re: prepared statement "cu1" already exists (but it does not) Thread-Topic: prepared statement "cu1" already exists (but it does not) Thread-Index: AQHaib67Y0oH94j070G2EwUnz+zRfbFejudUgAAUSYCAAWEFMIAAIIsAgAADAas= Date: Tue, 9 Apr 2024 16:48:46 +0000 Message-ID: References: <3298762.1712597811@sss.pgh.pa.us> <3751333.1712680610@sss.pgh.pa.us> In-Reply-To: <3751333.1712680610@sss.pgh.pa.us> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM9P191MB1286:EE_|GV2P191MB2334:EE_ x-volarisppoutbound: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pqX8wO7bP/50G4XZBJff+NIZmrVk0C3WcCTf6BYNsUz5esfFpVv0/2/YVGXpO6bq4C+mEx8Tvm2bFIuyyBQ00HJtN741oxWbONvlKI2Ji8ATSeYbXl7W+2xwoA/JB2Ud8q9zAoXdTnkK5fhP45J5IevWZQ9krXPYdu6bOSAuda9T9VXytRmz6pVqgkKaS5aIXUsLJuXjvu0LHJMGfLgvAVgE9Ge6gpO4QOfuDbjs6yZVe0vBokIE02ajVOtepgbSJtr+4b5pg+qq52zP/uMcvqEzfbiOHT54A0zH0gERtLqOqHa15s2girvQoOkZTfu3BIcOF7YWXjUQZ5rGCDM7gH6dyF/4X9iyOp/InqaDKwbVi4cOSwewR4ZM5wDE/Bft2PiL3HH4qDPT3kMswokjbH0gVj5S9z8psNBBZ6qcwZbM0vnODOCBNlGh7xsxwjHtyd4F0MwoLA/1bQ810HZjWOqVemV7ysaYAODAMJEYj11yHVG0ZpD15G7RUDlDRx2SwsSk7fZzdpkYdaC57zfi5MRZ9q61kyKrvCf0pIHElXTBVZb6RbV6XvyLZuDY8dkeCxPW84RcUeC8IwuxTHQt5hoW3K7Fh8jkhxZYOtykoV161npw5r5GX4/hN7n69wr2iXArP/gg8dUVFCfahRS04CyS2/d3DwcbecPxu3b99lw= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9P191MB1286.EURP191.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+pxygqnUNaxgY63PiOKznqC13TfzUwsY0O0+nwe02YQOwpwLzN8MX6pzeDQC?= =?us-ascii?Q?77JrXDL5UvJ29szCakupNASbTizw9DQwHr3Sr92/oinko6AKbzL+HtJCGGDN?= =?us-ascii?Q?BWWuhYi3+MiY09DpTZ7Jg7mE+bPNLz/9D/PmPtiWdZ6gZHI46+So/+hKE8eG?= =?us-ascii?Q?UU/t+4mAs+p8xYAUzUHzi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I9J?= =?us-ascii?Q?ptAUv955dyGviwbyQHS/cpb5Hpl6e/Lh5cIbOB1Xld1HIn7S4wTTT2tZnLLg?= =?us-ascii?Q?UOazvuvuewRVN9OFy7oQox9Lo/eUpFq/UyU5PGQ/FEGs+o3c9eLAUn12vt+C?= =?us-ascii?Q?atMYbjZ8+oyz7iBx2pwa6geEJ48FkJ/Z28BgeAxhs8dHJZSEUGANROWNEk3H?= =?us-ascii?Q?dmsOHyt8J0PfWzhVszu4WiMSaHfsIWj886vq4biIhVTbiX8Wt6YESi6B/xiG?= =?us-ascii?Q?3Pfs4LTDThXIlOGeuaMl7uRR6ANSkabf1EVxOWtglcrmeLqcV5x1H8SATJ+S?= =?us-ascii?Q?wRp3XFGjpf3WynDj7pYCTN7QtpH85E4o4DZ/+MARkZp5vrOhh9g+iwBAVC3a?= =?us-ascii?Q?6fMFp8l2n0fr56l91asshlxfxZpPTQpab7vvIt+35Y5gk2cw+HH2rdSNASrd?= =?us-ascii?Q?yyiqK+osMRRgERA1KQ4Es42FripWBDoVP80HS0+Mojc51itxSWc8gvTkSocu?= =?us-ascii?Q?htitnyz+dfjTBqlEj8V2MMQOBnbpZspUGk7TWr/w?= Content-Type: multipart/alternative; boundary="_000_AM9P191MB1286990B716F5DED6BCDFF99B0072AM9P191MB1286EURP_" MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: gWrUBSu2ogMujnAs3Ci9mDoWVaKDHhKR/ymHuJ1T27wzafcJRbEQjqMVEIG5wHKK575Uzbs5xQBD3WrQ8cEvL0fVNqydbsdQRznBGSlhtLb0ppVjlpjJ1N6AjC68DSiS/SWKzI+40XZVJ9nFaUbsXQSb+/WhFES8+WS55kFTYBxibyzhFd3JtEq2k56htnyv2Ek/kmbCR2RdC59iE/UTe5RB/i6HOu8+xH3EDt/CiHS9D4/CMnp/Y+EtXShO7VInDFDg4iNfynGbYQreKWqy0vVuNQ2Msb/UKn4OGsOvq7jF9OhjwFQeSJJurJ65HnUbAQcAXCFigtcbQQ0wSaBvcpxFYeV4chK1B2vvoPE+HTFpFC47PfFyNYIVQ6yhuUXVRmJh3CueoDrjMGndb4c8/RrrR/ePLOBm50Lo3+NqMPzLEm0hPb4V+ryytyhA32z6UsI3ZLqI5kdJYsU6ABUEIXnFHUkNGLiY7eeLdARW5tAnUPjG59Y8AKkDDtVnvMfo4fSxrk7eUw6Vywp8CRb3bQuM5/K6uJ4wrP5CUoRdqk1mAZ2bI1g95L3zVLCUZKuzbkuqafPXdAFEd/ESG1vQ0DM4tu1VX5ikavqAoWO5oljHDgyGVGFByPj5FOVyiwPIhAVSFNHb3R1Oo8hBANgwzg== X-OriginatorOrg: 4js.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM9P191MB1286.EURP191.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: e1aa1460-4a00-488a-bf16-08dc58b4eca1 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2024 16:48:46.6634 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 75c696ec-5bfb-4892-9a0c-9187a9061cd6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bdeJ5MvtNFQtYFuGNr++WrX+X1OGKPamWcTep76AOC9CRCrGj2bbCyQ4i2ysGEwPHAf33I4jfhUtRe77OGb91WZ8V4xIA97znNbBv0i8chg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2P191MB2334 X-Proofpoint-ORIG-GUID: caOo_Prv7FRNKq-XZFtClDPpT9cwFbJV X-Proofpoint-GUID: caOo_Prv7FRNKq-XZFtClDPpT9cwFbJV X-ProofpointHeader: Yes X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 phishscore=0 mlxlogscore=921 malwarescore=0 adultscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404090110 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_AM9P191MB1286990B716F5DED6BCDFF99B0072AM9P191MB1286EURP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ok thanks Tom, My understanding from your last comment: Since prepared statements and server cursors use different name spaces, it'= s save to use the same name as in PQprepare(pgConn, "cu1", "declare cu1 cursor for ... ", ... ) Seb ________________________________ From: Tom Lane Sent: Tuesday, April 9, 2024 6:36 PM To: Sebastien Flaesch Cc: pgsql-general Subject: Re: prepared statement "cu1" already exists (but it does not) EXTERNAL: Do not click links or open attachments if you do not recognize th= e sender. Sebastien Flaesch writes: >>> Is it an issue if I use the same name for a prepared statement and the = server cursor? I mean: >> From memory, I think those share the same "portal" namespace. > Can you please elaborate? > Is it supported to do: > PQprepare(pgConn, "cu1", "declare cu1 cursor for ... ", ... ) > PQexecPrepared(pgConn, "cu1", ... ) > ? > So far this has always worked. Ah, sorry, what I should have said is that the SQL PREPARE command works with the same namespace as PQprepare (which is a thin wrapper over the wire-protocol Parse command). There is a different namespace for cursors. Cursors do share that namespace with the wire-protocol "portal" concept, but libpq doesn't directly expose portals. regards, tom lane --_000_AM9P191MB1286990B716F5DED6BCDFF99B0072AM9P191MB1286EURP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Ok thanks Tom,

My understanding from your last comment:

Since prepared statements and server cursors use different name spaces, it'= s save to use the same name as in

PQprepare(pgConn, "cu1", "declare cu1 cur= sor for ... ", ... )

Seb

From: Tom Lane <tgl@sss.= pgh.pa.us>
Sent: Tuesday, April 9, 2024 6:36 PM
To: Sebastien Flaesch <sebastien.flaesch@4js.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: prepared statement "cu1" already exists (but = it does not)
 
EXTERNAL: Do not click links or open attachments i= f you do not recognize the sender.

Sebastien Flaesch <sebastien.flaesch@4js.com> writes:
>>> Is it an issue if I use the same name for a prepared statement= and the server cursor? I mean:

>> From memory, I think those share the same "portal" names= pace.

> Can you please elaborate?

> Is it supported to do:
>    PQprepare(pgConn, "cu1", "declare cu1= cursor for ... ", ... )
>    PQexecPrepared(pgConn, "cu1", ... )
> ?

> So far this has always worked.

Ah, sorry, what I should have said is that the SQL PREPARE command
works with the same namespace as PQprepare (which is a thin wrapper
over the wire-protocol Parse command).  There is a different namespace=
for cursors.  Cursors do share that namespace with the wire-protocol "portal" concept, but libpq doesn't directly expose portals.

            &nb= sp;           regards, to= m lane


--_000_AM9P191MB1286990B716F5DED6BCDFF99B0072AM9P191MB1286EURP_--