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

Comments

rdruzian’s picture

Hi ..

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).

thatoneguy’s picture

StatusFileSize
new437 bytes

Really? 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.

thatoneguy’s picture

Excuse the duplicate post.

Uclio’s picture

I guess the project owner doesn't care about PostgreSQL ;-)

quicksketch’s picture

Version: 7.x-3.11 » 7.x-3.15
Status: Active » Fixed
StatusFileSize
new1.32 KB

I just marked #1407554: The unique option while creating a field is not working duplicate, where I couldn't find the cause of this problem.

Really? 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.

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.

quicksketch’s picture

Title: webform_validate_unique && postgresql » webform_validate_unique() throws PDO error when using PostGres
thatoneguy’s picture

Makes 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.