Skip to content

Using two sequences in the same table #6422

Open
@sc0rp10

Description

@sc0rp10

I need to handle two sequences for the same table like this:

class Foo
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="SEQUENCE")
     * @SequenceGenerator(sequenceName="a_seq")
     */
    private $a;

    /**
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="SEQUENCE")
     * @SequenceGenerator(sequenceName="b_seq")
     */
    private $b;
}

But insert has failed with not null violation on "b".
A query looks like INSERT INTO foo (a, b) VALUES (42, null).
My DDL allow usingDEFAULT nextval('b_seq'::regclass);, but Doctrine pass null explicit and breaks query.
How can I avoid them?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions