From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Amn Ojee Uw <amnojeeuw@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: PSQL = Yes ... JDBC = no ??
Date: Sun, 3 Sep 2023 09:04:19 -0700
Message-ID: <9524571e-96ed-15f0-4f70-89d9bbe273b9@aklaver.com> (raw)
In-Reply-To: <cbe8bd8f-7d34-29b3-a169-9cefb9f1de83@gmail.com>
References: <cbe8bd8f-7d34-29b3-a169-9cefb9f1de83@gmail.com>
On 9/3/23 09:00, Amn Ojee Uw wrote:
> Hello!
>
> This issue really puzzles me beyond intrigue.
>
> Why would this schema:
> *SELECT 'CREATE DATABASE jme_test_database' WHERE NOT EXISTS (SELECT
> FROM pg_database WHERE datname = 'jme_test_database')\gexec*
> work when entered at the psql prompt, but not when passed as a parameter
> in a JDBC method?
>
> The bellow snip demonstrates the the creation of a String object with
> same character string used in the PSQL#.
> //CREATE DATABASE IF NOT EXISTS
> //~~~~~~~~~~~~~~~~~~
> *var s = new ***myString*(SELECT 'CREATE DATABASE jme_test_database'
> WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname =
> 'jme_test_database')\gexec);**
\gexec is a psql specific meta-command.
See Meta-Commands here:
https://www.postgresql.org/docs/current/app-psql.html>
> Any help would be very much appreciated.
>
> Thanks in advance.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, amnojeeuw@gmail.com
Subject: Re: PSQL = Yes ... JDBC = no ??
In-Reply-To: <9524571e-96ed-15f0-4f70-89d9bbe273b9@aklaver.com>
References: <cbe8bd8f-7d34-29b3-a169-9cefb9f1de83@gmail.com> <9524571e-96ed-15f0-4f70-89d9bbe273b9@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox