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
-- name: ListCaseIntentHistory :many
WITH RECURSIVE descendants AS
( SELECT case_intent_parent_id AS parent, case_intent_id AS child, 1AS lvl
FROM case_intent_parent_join
UNION ALLSELECTd.parentas parent, p.case_intent_idas child, d.lvl+1as lvl
FROM descendants d
JOIN case_intent_parent_join p
ONd.child=p.case_intent_parent_id
)
select distinct child, 'child' group_
from descendants
where parent = @case_intent_id
unionselect distinct parent, 'parent' group_
from descendants
where child = @case_intent_id
ORDER BY child;
I found a workaround for SQLite, give it na extra kick.
CREATE TABLE IF NOT EXISTS c
(
port_num INTEGER NOT NULL
);
CREATE VIEW IF NOT EXISTS all_ports AS
WITH RECURSIVE c(port_num) AS
(VALUES (1)
UNION ALL
SELECT port_num + 1
FROM c
WHERE port_num < 65535)
SELECT port_num
FROM c;
Now I'm migrating to Postgres and got the kick back.
CREATE VIEW all_ports AS
WITH RECURSIVE c(port_num) AS
(SELECT 1
UNION ALL
SELECT port_num + 1
FROM c
WHERE port_num < 65535)
SELECT port_num
FROM c;
* test: Add case for #2132
* test: Add case for #2152
* test: Mark case for #2152
* test: Add case for #2187
* test: Add case for #2226
* test: Add case for #2364
* test: Add case for #2386
* test: Add case for #2538
* test: Add case for #2644
* test: Add case for #2731
Version
1.17.2
What happened?
We tried to generate go code for a CTE using WITH RECURSIVE, but sqlc breaks.
Note: this may be a duplicate of #1912
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/cf9b0cde66620c6c151bad0b6d6f6ccd40b510fa6e1e6541621b777b4f970b17
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: