Skip to content

Upsert creating custom functions even when a postgres unique constraint is in place #128

@searls

Description

@searls

I did my best to follow the README on this one, but I'm still missing something. Running on master

From my structure.sql:

CREATE TABLE public.items (
    id bigint NOT NULL,
    jmdict_id bigint
    -- etc…
);

ALTER TABLE ONLY public.items
    ADD CONSTRAINT items_constraint_on_jmdict_id UNIQUE (jmdict_id);

When I call Upsert.batch:

      Upsert.batch(Item.connection.raw_connection, :items) do |upsert|
          upsert.row({
            jmdict_id: some_id,
          }, {
            # etc…
          })
      end

And then I run rake db:structure:dump, I'll get:

CREATE FUNCTION public.upsert3_0_0_items_sel_jmdict_id_set_created_at_a_jmdi2123077596
-- etc…

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