Intermittent error from Redshift: SUBSTR() not supported

j4nd3r53n's profile image j4nd3r53n posted 3 years ago in General Permalink

I get an error from Redshift (based on PostgreSQL 8), suggesting I should use SUBSTRING() instead of SUBSTR() (see attated file). Is this something I can change in my configuration, perhaps?

1 attachment(s):
  • heidierror
ansgar's profile image ansgar posted 3 years ago Permalink

Interesting - the original thread for Redshift support did not meantion such an incompatibility. Is that perhaps an older Redshift version?

ansgar's profile image ansgar posted 3 years ago Permalink

Oh, look at issue #1259 - that replaced LEFT() with SUBSTR() in PostgreSQL mode, including Redshift. Looks like Redshift needs SUBSTRING() then. The docs also state that SUBSTRING() is a valid option on normal PostgreSQL servers, even older ones.

j4nd3r53n's profile image j4nd3r53n posted 3 years ago Permalink

As I understand it, Redshift is based on PostgreSQL 8, and the manual for that version doesn't mention SUBSTR(), only SUBSTRING().

Not sure about the version - it was created a couple of months ago, but you don't get a choice of versions.

Code modification/commit 38c3a82 from Ansgar Becker <anse@heidisql.com>, 3 years ago, revision 11.3.0.6338
Prefer SUBSTRING() over SUBSTR() in Postgres mode, to restore Redshift compatibility. See https://www.heidisql.com/forum.php?t=38326 and issue #1259
ansgar's profile image ansgar posted 3 years ago Permalink

Next HeidiSQL build uses SUBSTRING for all PG servers including Redshift.

You can update to that new build in half an hour via Help > Check for updates.

j4nd3r53n's profile image j4nd3r53n posted 3 years ago Permalink

Thanks! That was bloody quick, if you'll excuse my language :-)

Please login to leave a reply, or register at first.