Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: insert/update problems!!!

  1. #1
    Join Date
    Apr 2011
    Posts
    28

    Question insert/update problems!!!

    Hi, I want to compare 2 tables postgres with join lef outter and input the results in a table. Now I have some errors: "duplicate keys valus violate unique constraints". help please

    Bhebb

  2. #2
    Join Date
    Sep 2010
    Posts
    135

    Default

    Do you have any CONSTRAINT in your table? It seems that you are trying to insert a repeated value in a column that is defined as PRIMARY KEY.

  3. #3
    Join Date
    Apr 2011
    Posts
    28

    Default

    Yes, I have. primary key!!! I have 2 tables joined, that means if the id(PK) is the same, I want to do a update, in other case I make a insert. It's logical...

  4. #4
    Join Date
    Sep 2010
    Posts
    135

    Default

    Ok. But what happens if you try to insert two rows with the same primary key? It can happen that you have a repeated primary key value in one table and this value does not appear in the other table. In this case, the first time you try to insert the value will work ok but not for the rest.

    If this is the cause of your problem you can solve it using "Unique Rows".

    You can also upload your transformation because it will be easier to help you.

  5. #5
    Join Date
    Apr 2011
    Posts
    28

    Default

    thx, for ur help. I have to transfer 465 tables from base 1 to Base to with many transformations. That means, There'll be many tables joined... Hope ur help
    Attached Files Attached Files

  6. #6
    Join Date
    Sep 2010
    Posts
    135

    Default

    So I understand that you want to update the value of 'S5_init' with the data of 'S1_init'. You do not have to check 'Don't perform any updates' checkbox, and in the list of 'Update columns' remove 'id'. This is what it says in the Pentaho wiki:

    "The Insert/Update step first looks up a row in a table using one or more lookup keys. If the row can't be found, it inserts the row". The lookup key is the id in your case so if it doesn't found it will insert it automatically. You can check this information in the following link:

    http://wiki.pentaho.com/display/EAI/Insert+-+Update

    Good luck!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.