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 1rCcKG-00Geaa-8X for pgsql-general@arkaria.postgresql.org; Mon, 11 Dec 2023 09:11:44 +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 1rCcKE-00CVVd-TQ for pgsql-general@arkaria.postgresql.org; Mon, 11 Dec 2023 09:11:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rCNmL-007xrk-Ez for pgsql-general@lists.postgresql.org; Sun, 10 Dec 2023 17:39:45 +0000 Received: from sendmail.purelymail.com ([34.202.193.197]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rCNmE-00BFZo-K0 for pgsql-general@lists.postgresql.org; Sun, 10 Dec 2023 17:39:44 +0000 DKIM-Signature: a=rsa-sha256; b=fQCDjSQiFQl7yieyyzrikQMIgzw8wHb+ENyWOueyJsX6vnX8x6dvo0kP7NoDCtFl3i3u2QGAZ8FFmUlJ/smHIcmGhkbSBLpL5lYemPd4S01thsupu3sJQ7SV/zm7tLSqL4Mubban4kIPoY8jyDxfVVxtofLw7SzxQvCd/IDNIQzboXG3gmgCSuCDQGw5pc4qkCEsqZkjdFyTm+mUhN5eESP2uLMVlSMgMpXP3vO64JA8aVUAZ0amfGUZ8gUI0Tz8dUwp4euHT/eDAz/ZezPo/ewHfmLkn9eSq7K7YVYVMN4ZHSJnCJ4JHe/lIGGhDkWHXYSGY9LnOCfqxbq/SQs+Xg==; s=purelymail1; d=libremen.org; v=1; bh=YjsvyUEX7Ur1gruKUKRDT5aJdD7QQodCrM3S2AS9rpY=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=E5rH4NUV9TFA1RJylHeS7/Ucqt2GzpkmCyNFo1rQtbWeLo731gG4qaeISuhiH3E7f1e2rsUrqkXs6blZP4UL6TpPfod+mqkBOJUMfF09hGFo33onsDXtsr54BBcUYYjIQNrx9LW7TuiQFXblQTI7OUGAhuBpIvNkWS6kltug9tZjvlgHAPJNnz2eDRAyTL7SZeOucr8MndO4hv3MbY+o5gMAqfTlC9OTvbLpOQXEjV2tkdWIJMSUoX59EVUB3IsUcpYjKjcN7K49mMJI5i+DeSMaKq8XcHQh09M87DUSpf0X3dvHrNU/BJXkds4tshvUM/fitywCrFqCDYU7Np55qw==; s=purelymail1; d=purelymail.com; v=1; bh=YjsvyUEX7Ur1gruKUKRDT5aJdD7QQodCrM3S2AS9rpY=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 2722:668:null:purelymail X-Pm-Original-To: pgsql-general@lists.postgresql.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -791494771; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 10 Dec 2023 17:39:25 +0000 (UTC) Date: Sun, 10 Dec 2023 18:39:24 +0100 From: Vincent Veyron To: David Gauthier Cc: pgsql-general@lists.postgresql.org Subject: Re: running \copy through perl dbi ? Message-Id: <20231210183924.196759a6e72d0dadf31cf44e@libremen.org> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 8 Dec 2023 10:45:28 -0500 David Gauthier wrote: >=20 > I'm trying to run a PG client side "\copy" command from a perl script. I > tried using $dbh->do("\\copy ...") but it barffed when it saw the '\'... > ERROR: syntax error at or near "\" >=20 > I can do this with a command line approach, attaching to the DB then run > using... Duh! I just realized that what I proposed with system() is a command line a= pproach. As David Johnston mentionned, you can use the SQL COPY command.=20 However, you need then to deal with permissions so that the server may writ= e the file, so I wonder what approach is cleaner? --=20 Bien =E0 vous, Vincent Veyron https://marica.fr Logiciel de gestion des contentieux juridiques, des contrats et des sinistr= es d'assurance