Re: Altering a column if it exists

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Altering a column if it exists
Date: 2014-01-08 22:43:30
Message-ID: 1389221010412-5785954.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

David Johnston wrote
>
> Tom Lane-2 wrote
>>> END$$;
>>
>> If you dig down through all the Java noise, the problem reported by the
>> database server is:
>>
>>> org.postgresql.util.PSQLException: ERROR: unterminated dollar-quoted
>>> string
>>
>> So apparently something on the client side is splitting this into more
>> than one command to be sent to the server; it looks like that something
>> thinks the first semicolon terminates the command, even though it's
>> inside
>> a quoted string. Most likely, that code doesn't understand
>> dollar-quoting
>> at all.
> More likely it is the fact that you do not have a space between "END" and
> the "$$".
>
> In certain situations there can be a problem using dollar-quoting with
> JDBC - mainly in regards to JDBC-compliant escaping but I do not recall
> the specifics at the moment - but a straight literal $$...$$ block works
> just fine.
>
> David J.

Not sure what I was thinking here but the space-issue cannot be right though
the "END" does need a semi-colon to be valid pl/pgsql. Normally after the
semi-colon you would have a newline and then the closing dollar-quotes.
That layout is what I was looking for but mis-translated it into a
white-space error which is obviously wrong since $$somevalue$$ is indeed
valid.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Altering-a-column-if-it-exists-tp5785924p5785954.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2014-01-08 23:06:25 Re: Altering a column if it exists
Previous Message David Johnston 2014-01-08 22:31:59 Re: Altering a column if it exists