Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Certain SQL statements (NO KEY, RECURSIVE) aren't parsed correctly #494

Open
Labels
bugSomething isn't working
@reteps

Description

Bug report

SELECT
 1
FROM
 assessments AS a
WHERE
 a.id = $assessment_id
FOR NO KEY UPDATE;
apps/prairielearn/src/lib/assessment.sql:544:12 syntax ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ✖ Invalid statement: syntax error at or near ";"
 542 │ WHERE
 543 │ a.id = $assessment_id
 > 544 │ FOR NO KEY UPDATE;
 │ ^^^^^^^
 545 │
 546 │ -- BLOCK select_assessment_needs_statistics_update
WITH RECURSIVE
 template_questions AS (
 -- non-recursive term that finds the ID of the template question (if any) for question_id
 SELECT
 tq.id,
 tq.qid,
 tq.course_id,
 tq.template_directory
 FROM
 questions AS q
 JOIN questions AS tq ON (
 tq.qid = q.template_directory
 AND tq.course_id = q.course_id
 )
 WHERE
 q.id = $question_id
 AND tq.deleted_at IS NULL
 -- required UNION for a recursive WITH statement
 UNION
 -- recursive term that references template_questions again
 SELECT
 tq.id,
 tq.qid,
 tq.course_id,
 tq.template_directory
 FROM
 template_questions AS q
 JOIN questions AS tq ON (
 tq.qid = q.template_directory
 AND tq.course_id = q.course_id
 )
 WHERE
 tq.deleted_at IS NULL
 )
SELECT
 id
FROM
 template_questions
LIMIT
 100;
apps/prairielearn/src/lib/chunks.sql:73:6 syntax ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ✖ Expected IDENT
 72 │ -- BLOCK select_template_question_ids
 > 73 │ WITH RECURSIVE
 │ ^^^^^^^^^
 74 │ template_questions AS (
 75 │ -- non-recursive term that finds the ID of the template question (if any) for question_id

To Reproduce

Reproduction is identical to #482

System information

  • v0.12.0 (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /