freelancing-god/thinking-sphinx — Issue #326: PGError: ERROR:  unterminated dollar-quoted string at or near "$$
Author: mattscilipoti
Created: 2012-01-13 19:37:11+00:00
State: open

After using ts, we get this error when running `rake db:structure:load`:
PGError: ERROR: unterminated dollar-quoted string at or near "$$

It is caused by the dollar-quoted crc32 function.

rails (3.1.3)
pg (0.11.0)
postgres (9.1.2)
OSX (10.7.2)

I tried a few different syntaxes from recommendations I found online, but none of them worked.

According to http://www.postgresql.org/docs/8.2/interactive/plpgsql-development-tips.html, "The dollar quoted strings are not always supported by JDBC drivers which may split the function definition into separate pieces at semicolons. If the java-based software (ExecuteQuery, Eclipse and so on) shows the error message like "unterminated dollar-quoted string at or near $$ ", use apostroph instead of $$ to define the end and the beginning of the function. In the most cases it is not so clumsy as it is shown in the chapter to double apostrof if it is required in the function body. This seems not a problem when using the psql tool instead."

I tried converting the $$ into an apostrophe and (I think I) followed the directions on double ticking throughout the definition, but now I get:
PGError: ERROR: unterminated quoted string at or near "'

Any ideas?

Thanks, Matt