You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following SQL used to cause sqlc to panic. That was fixed in #158. Sadly, sqlc still can't handle the aliasing of a subquery. When trying to compile the following SQL:
CREATETABLEauthors (
id BIGSERIALPRIMARY KEY,
name TEXTNOT NULL,
bio TEXT
);
-- name: SubAuthors :manySELECTsub.nameFROM (SELECT*FROM authors) sub
Hi,
I'm seeing similar errors with a few variations on this join. Is this a related issue, or shall I raise a seperate one?
SELECT f, b
FROM foo f
JOIN bar b ON b.id = f.id
WHERE f.id = $1;
query.sql:6:8: column "f" does not exist
SELECT foo, bar
FROM foo
JOIN bar ON bar.id = foo.id
WHERE foo.id = $1;
query.sql:6:8: column "foo" does not exist
SELECT f.id, b.title
FROM foo f
JOIN bar b ON b.id = f.id
WHERE f.id = $1;
query.sql:6:8: column "id" does not exist
SELECT
chg.*,
c.shaAS commit_sha,
SPLIT_PART(c.message, E'\n', 1)::TEXTAS commit_subject,
b.*,
pkg.relative_path,
mod.path,
mod.versionFROM
(
SELECT*,
(ROW_NUMBER() OVER (PARTITION BY commit_index ORDER BY effect_size DESC)) AS ranking
FROM
changes
WHERE1=1AND ABS(chg.effect_size) >sqlc.arg(effect_size_min)
AND commit_index BETWEEN sqlc.arg(commit_index_min) ANDsqlc.arg(commit_index_max)
) AS chg
INNER JOIN commit_positions AS p
ONchg.commit_index=p.indexINNER JOIN commits AS c
ONp.sha=c.shaINNER JOIN benchmarks AS b
ONchg.benchmark_uuid=b.uuidINNER JOIN packages AS pkg
ONb.package_uuid=pkg.uuidINNER JOIN modules AS mod
ONpkg.module_uuid=mod.uuidWHERE1=1ANDchg.ranking<=sqlc.arg(num_per_commit)
ORDER BYchg.commit_indexDESC
;
Error:
query/changes.sql:39:9: column "ranking" does not exist
Activity
tgascoigne commentedon Dec 24, 2019
Hi,
I'm seeing similar errors with a few variations on this join. Is this a related issue, or shall I raise a seperate one?
kyleconroy commentedon Dec 24, 2019
@tgascoigne I think this is different. I've moved your report to issue #213
dharmjit commentedon Apr 24, 2020
Hi Kyle, This issue has impacted me as well. Any update on this.
mmcloughlin commentedon May 12, 2020
I think I have an instance of this issue:
Error:
maxhawkins commentedon May 14, 2020
I believe this is fixed by #489