1

Topic: SQL Error with pre-built form record_details_2

Sorry - here's another problem:

I was thinking about building my own record details form when I stumbled across two prebuilt forms under "Utilities". The first - record_details -  is pretty basic. record_details_2 looks more promising, but generates an SQL error with me:

ERROR: function right(character varying, integer) does not exist at character 730 HINT: No function matches the given name and argument types. You might need to add explicit type casts

Cheers
Alan

Alan Hale
Aberystwyth

2

Re: SQL Error with pre-built form record_details_2

Hi Alan

An easy one.
PostgreSQL added the right() function in version 9.1. We should not be using it.

The offending report can be found in reports/ reports_for_prebuilt_forms/ record_details_2/ record_data_attributes_with_hiddens.xml.

Would you like to try working out how to do it with version 8.4 string functions?

Jim Bacon.

3

Re: SQL Error with pre-built form record_details_2

Hi Jim - glad it was an easy one!

Yes, I'll certainly have a go at modifying the form using the 8.4 functions.

(Still trying to figure out how to upgrade to Postgresql 9.2 - there are some complications on my web server. Not a high priority for me at the moment though).

Cheers

Alan

Alan Hale
Aberystwyth

4 (edited by Alan Hale 23-03-2013 14:53:00)

Re: SQL Error with pre-built form record_details_2

OK, this works:

I've altered

CASE WHEN right(a.caption, 4) = 'link' AND left(av.text_value, 4) = 'http'

to

CASE WHEN substring(a.caption from (char_length(a.caption)-5) for 4) = 'link' AND substring(av.text_value from 0 for 4) = 'http'

Alan

Alan Hale
Aberystwyth

5

Re: SQL Error with pre-built form record_details_2

Thanks Alan. I've committed that change to SVN.

John van Breda
Biodiverse IT