Skip to content

[go, postgres] relation not being found anymore #1078

Closed
@Streppel

Description

@Streppel

schema.sql

create table events
(
    ID int
);

create table handled_events
(
    last_handled_id int,
    handler text
);

queries.sql

-- name: SelectAllJoined :many
select e.* from events e
    inner join handled_events he
       on e.ID > he.last_handled_id
where he.handler = $1
    for update of he skip locked;

Before commit 070717, this would generate the following query:

const selectAllJoined = `-- name: SelectAllJoined :many
select e.ID from events e
    inner join handled_events he
       on e.ID > he.last_handled_id
where he.handler = $1
    for update of he skip locked
`

Now, an error is thrown

# package db
queries.sql:1:1: relation "he" does not exist

The error goes away if we ditch the for update lock in the query

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions