Hi
form html
webform.components.inc:function webform_validate_unique($element, $form_state) {
webform.components.inc- if ($element['#value'] !== '') {
webform.components.inc- $nid = $form_state['values']['details']['nid'];
webform.components.inc- $sid = $form_state['values']['details']['sid'];
$sid is empty
ERROR: invalid input syntax for integer: "" at character 150
Jul 12 23:25:15 db postgres[11422]: [4-2] STATEMENT: SELECT webform_submitted_data.sid AS sid
Jul 12 23:25:15 db postgres[11422]: [4-3] FROM
Jul 12 23:25:15 db postgres[11422]: [4-4] drupal_webform_submitted_data webform_submitted_data
Jul 12 23:25:15 db postgres[11422]: [4-5] WHERE (nid = '365') AND (cid = '7') AND (sid <> '') AND (data = '54321@54321.ru')
Jul 12 23:25:15 db postgres[11422]: [4-6] LIMIT 1 OFFSET 0
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | webform_validate_unique_empty.patch | 1.32 KB | quicksketch |
| #2 | webform.module.init_sid.patch | 437 bytes | thatoneguy |
Comments
Comment #1
rdruzian commentedHi ..
Similar problem... when press submit button in form:
PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:invalid input syntax for integer: ""
LINE 4: WHERE (nid = '10') AND (cid = '2') AND (sid <> '') AND (dat... ^: SELECT webform_submitted_data.sid AS sid FROM {webform_submitted_data} webform_submitted_data WHERE (nid = :db_condition_placeholder_0) AND (cid = :db_condition_placeholder_1) AND (sid <> :db_condition_placeholder_2) AND (data = :db_condition_placeholder_3) LIMIT 1 OFFSET 0; Array ( [:db_condition_placeholder_0] => 10 [:db_condition_placeholder_1] => 2 [:db_condition_placeholder_2] => [:db_condition_placeholder_3] => rdruzian@... ) in webform_validate_unique() (line 1050 of /var/www/drupal7/sites/all/modules/webform/includes/webform.components.inc).
Comment #2
thatoneguy commentedReally? This issue has been open since July, 2011, and still has not been fixed. I just received it today. This is a simple fix: Don't initialize an integer to an empty string.
Comment #3
thatoneguy commentedExcuse the duplicate post.
Comment #4
Uclio commentedI guess the project owner doesn't care about PostgreSQL ;-)
Comment #5
quicksketchI just marked #1407554: The unique option while creating a field is not working duplicate, where I couldn't find the cause of this problem.
Yes it's hard to find and resolve problems specifically affecting PostGres when I don't regularly use it. Not using PostGres, I obviously hadn't had the same problem.
I've committed this patch which takes a different approach of simply not including the SID in the query if it's empty. Although it's unlikely that changing the SID in $form_state to 0 instead of an empty string would break things, I'd prefer not to change it to avoid unexpected consequences of that. In any case, the SID really isn't 0 anyway, it's just not there at all.
Comment #6
quicksketchComment #7
thatoneguy commentedMakes more sense, I suppose. I couldn't figure out from the code why SID was being passed when logically, there shouldn't yet be a SID for a new form.