Re: PSQL = Yes ... JDBC = no ?? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: PSQL = Yes ... JDBC = no ??
Date
Msg-id 9524571e-96ed-15f0-4f70-89d9bbe273b9@aklaver.com
Whole thread Raw
In response to PSQL = Yes ... JDBC = no ??  (Amn Ojee Uw <amnojeeuw@gmail.com>)
Responses Re: PSQL = Yes ... JDBC = no ??
List pgsql-general
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




pgsql-general by date:

Previous
From: Amn Ojee Uw
Date:
Subject: PSQL = Yes ... JDBC = no ??
Next
From: Amn Ojee Uw
Date:
Subject: Re: PSQL = Yes ... JDBC = no ??