Auto increment postgres serial type in logic app insert row action ID field

Liam O'Dowd 26 Reputation points
2022-03-01T00:53:14.293+00:00

Hi,

The insert row action is requiring an ID field but my table in postgres is type serial. Is there anyway to tell the logic app that an ID field does not need to be set on the insert as postgres will auto increment this field?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,381 questions
Azure Database for PostgreSQL
{count} vote

2 answers

Sort by: Most helpful
  1. Ronen Ariely 15,201 Reputation points
    2022-03-03T12:25:30.98+00:00

    Hi,

    insert row action is requiring an ID

    (1) Why?!? Please clarify why you have to use the column ID when you INSERT data and how exactly do you INSERT the data.

    (2) If the insert row action is requiring an ID and you have Auto increment then what do you expect to have in the column? Do you want to INSERT your value or use the Auto increment?

    Note! Identity in postgres does not behave like identity in SQL Server. You can simply configure: ColumnName INT GENERATED BY DEFAULT AS IDENTITY,

    For example:

    CREATE TABLE MyTable(
        ID INT GENERATED BY DEFAULT AS IDENTITY,
        Text VARCHAR NOT NULL
    );
    

    This way, you get the option to INSERT the value to the column if you want or not. If you do not INSERT the value then the it is Auto increment

    0 comments No comments

  2. Power Automate 0 Reputation points
    2024-11-07T07:13:45.96+00:00

    Solution

    I solved this issue by initalizing an iteger variable that has no vlaue and referncing it in the id colum of the postgers insert Action

    Hope this helps ;)


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.