RE: ERROR: unterminated dollar-quoted string at or near "$$"

Поиск
Список
Период
Сортировка
От Ravulapati, Gautham
Тема RE: ERROR: unterminated dollar-quoted string at or near "$$"
Дата
Msg-id SA1PR15MB4904DB4669E809F4551303B3969F9@SA1PR15MB4904.namprd15.prod.outlook.com
обсуждение исходный текст
Ответ на Re: ERROR: unterminated dollar-quoted string at or near "$$"  (Francisco Olarte <folarte@peoplecall.com>)
Список pgsql-bugs
Hi,

Thank you for your response and time. I will look at the general list you mentioned.
Yes I am having challenge with PSQL.exe on windows,  I am  sending SQL's  as file using  -f parameter in PSQL.exe.

SQL file contain triggers, function codes with SS or $BODY$.

Regards,
Gautham.R

-----Original Message-----
From: Francisco Olarte <folarte@peoplecall.com> 
Sent: Thursday, August 4, 2022 3:57 PM
To: Ravulapati, Gautham <Gautham.Ravulapati@ncr.com>
Cc: pgsql-bugs@lists.postgresql.org; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: ERROR: unterminated dollar-quoted string at or near "$$"

*External Message* - Use caution before opening links or attachments

NOTE: CCing to general.

Hi,

On Thu, 4 Aug 2022 at 10:22, Ravulapati, Gautham <Gautham.Ravulapati@ncr.com> wrote:
> I am trying to create functions and triggers from PSQLl on windows. 
> Same SQL scripts work from Linux PSQL but fail with following error
> ERROR:  unterminated dollar-quoted string at or near "$$"

Let's go looking for the usual suspects.

When you say PSQLI on windows, are you referring to the "psql"( I assume it's .exe ) from standard postgres ?
When you say Linux PSQL are you referring to "psql" from postgres ?

I ask this because Linux is case sensitive, while windows is case preserving, and you refer to
> I see that PSQL version 7 .6 is same across all the postgres version on windows. Is there no latest version of PSQL
.
without the "I" later. Answer is probably yes/yes, but lets rule it out.

How are you feeding the scripts to said programs? -f psql switch?
input redirection from the shell? -c and inline?

This is important because in linux shells have regular, although sometimes complex, quoting behaviours, but in windows
quotingis different and done by the programs.
 

> One of the workaround I found was to substitute $$ with single quote and all single quote with double quotes, in my
caseI cannot do this for two reasons.
 

This leads me to think you are doing something inline, as in sql you cannot change quotes ( single quotes are for
strings,double are for identifiers ).
 

> Same scripts need to execute on linux and windows These SQl files are 
> generated one and would completely new implementation for replacing the $$.

Can you share some part of the scripts? Can you check which kind of line endings you are using ?( I doubt it is the
lasteone because that will fail normally, if anywhere, on linux, due to extra \015 ).
 

> Kindly let me know if there  are any options at PSQL level or any recommendations.

Last, but not least. This does not seem like a pg bug, but like an operator error.  I've replied here once, but will
notreply to any followup directed to the bug list, you should try this things in the general list, and post here (
afterreading the bug posting guidelines ). Many times pilot errors in the bug list get just discarded, as knowledgeable
peoplehere are busy solving bugs.
 

If you read the headers you'll see I have added the general list, if you replay I strongly recommend you zap the bugs
listbefore replying to all.
 

Francisco Olarte.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: ERROR: unterminated dollar-quoted string at or near "$$"
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: No-op updates with partitioning and logical replication started failing in version 13