2

I am trying to write my first trigger. It is an insert trigger as follows:

<b>Fatal error</b>:  postgres7 error: [-1: ERROR:  INSERT has more target columns than expressions at character 78

INSERT INTO
dash_pre_queue
            (ord_obj_guid,
             ord_entry_type_guid,
             client_obj_guid, 
             installer_obj_guid, 
             installer_serial_number, 
             datetime, 
             ord_proc_state_guid,
             created,
             ord_esc_type_guid,
             in_error,
             ord_entry_guid)
SELECT
    (ord_obj_guid,
            NULL,
            client_obj_guid,
            inst_obj.inst_obj_guid,
            inst_obj.installer_serial_number,
            clock_timestamp(),
            ord_proc_state_guid,
            NULL,
            NULL,
            NULL,
            NULL)
    FROM
            ord_obj
    JOIN
            inst_obj ON inst_obj.inst_obj_guid = ord_obj.inst_obj_guid
    WHERE
            ord_obj.ord_obj_guid = NEW.ord_obj_guid

I left the error message on top. The structure of the target table matches the INSERT INTO columns. I have verified the NULL values are allowed.

If you count the columns in the Insert clause, they match the SELECT statement, yet, I get the error above stating that there is somehow a disconnect. Any ideas as to what I am doing wrong?

1
  • just for giggles check and see if dash_pre_queue has any triggers
    – HLGEM
    Commented Feb 8, 2013 at 14:47

1 Answer 1

2

Remove parens around column list in select. This doesn't do what you think it does.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.