Re: Altering a column if it exists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Altering a column if it exists
Date: 2014-01-08 23:06:25
Message-ID: 19267.1389222385@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

David Johnston <polobo(at)yahoo(dot)com> writes:
> 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.

I think years ago we required a semicolon after the last END of a plpgsql
function body, but we don't anymore. In any case, the error is being
thrown before the plpgsql parser ever gets to look at the string, so
whether that's true or not isn't the immediate problem.

At this point I'm betting the OP is using an old JDBC driver version
that doesn't understand dollar-quoted strings, or that there's some
layer above it in his client software stack that doesn't understand
them (but thinks it knows how to pull apart multi-statement SQL
strings).

A quick look into the pgsql-jdbc archives says that dollar quote parsing
was implemented in 2006, with some bug fixes (for cases this example
wouldn't hit) in late 2007. I don't know how that relates to JDBC driver
version numbers unfortunately, but certainly anything less than about five
years old ought to be OK.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message johnnorman 2014-01-09 06:08:03 Re: How to Recover iPhone Contacts You Lost Somehow?
Previous Message David Johnston 2014-01-08 22:43:30 Re: Altering a column if it exists