Skip to content

On master, prepare_query adds clause to non soft-deletable tables #185

Description

@caioaao

I tried running the tests from my company's repo using the master branch and it fails. It seems that now it tries to add the deleted_at IS NULL query where it shouldn't. Here's a sample of the error when running our tests (pretty printed and redacted query, but tried to keep the overall structure for reference):

  ** (Postgrex.Error) ERROR 42703 (undefined_column) column s0.deleted_at does not exist

SELECT s0."id", i1."id", i1."xxx_id", ...
FROM (SELECT DISTINCT ON (sl0."id") sl0."id" AS "id"
	FROM "yyys" AS sl0 
	INNER JOIN  ...
	INNER JOIN ...
	WHERE (...  AND (sl0."deleted_at" IS NULL)) ) AS s0 
INNER JOIN ... 
WHERE ... AND (s0."deleted_at" IS NULL)

I checked and v 2.0.4 works correctly. It seems like PR #141 might have introduced this

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions