Skip to content

Table referencing itself #47

Open
Open
@francescovenica

Description

Hello,

I have a question about a case where a table has a parent_id like this:

CREATE TABLE item (
  uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4 (),
  parent_uuid uuid REFERENCES item (uuid) ON DELETE CASCADE,
  title text
);

is it possible from this to create the parent item and also the child item (wo where parent_uuid is the uuid of the parent item)?

many thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions