Re: PSQL = Yes ... JDBC = no ??

From: Amn Ojee Uw <amnojeeuw(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PSQL = Yes ... JDBC = no ??
Date: 2023-09-03 22:25:25
Message-ID: c49fdab5-a81c-63b0-06e8-d34e16800a34@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Adrian, I did read the link you suggested.
I was had at the Introduction title, since it makes this mention
"/Alternatively, input can be from a file or from command line
arguments./" since the input would be from the back end of the database,
as I am using Java DBC to access the database.

However, I have not been able to discern the correlation that exist
between the*JDBC statement *and the definition of *gexec* [/Sends the
current query buffer to the server, then treats each column of each row
of the query's output (if any) as an SQL statement to be executed./]

I guess it is that I am so new to the world of PG-15 that I just cannot
understand or get your point. My reality is that esoteric definition go
right over my head, since I am a newbie.

Would you be able to make the appropriate corrections to the
PostgreSQL-15 schema passed to the JDBC Statement.executeUpdate() method?

Thanks in advance.

PD:

Are you saying that JDBC cannot handle or process \gexec, since it is
PG-15 exclusive?

On 9/3/23 12:04 p.m., Adrian Klaver wrote:
> 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.
>>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Maciek Sakrejda 2023-09-03 23:46:19 Re: PSQL = Yes ... JDBC = no ??
Previous Message Adrian Klaver 2023-09-03 16:04:19 Re: PSQL = Yes ... JDBC = no ??