René's URL Explorer Experiment


Title: PRAGMA queries are not recognised · Issue #3237 · sqlc-dev/sqlc · GitHub

Open Graph Title: PRAGMA queries are not recognised · Issue #3237 · sqlc-dev/sqlc

X Title: PRAGMA queries are not recognised · Issue #3237 · sqlc-dev/sqlc

Description: Version 1.25.0 What happened? SQLite requires a PRAGMA query to enable foreign key constraints. Unfortunately, sqlc does not seem to recognise PRAGMA as a valid query, and actually collects everything until the first query it does recogn...

Open Graph Description: Version 1.25.0 What happened? SQLite requires a PRAGMA query to enable foreign key constraints. Unfortunately, sqlc does not seem to recognise PRAGMA as a valid query, and actually collects everyth...

X Description: Version 1.25.0 What happened? SQLite requires a PRAGMA query to enable foreign key constraints. Unfortunately, sqlc does not seem to recognise PRAGMA as a valid query, and actually collects everyth...

Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/3237

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PRAGMA queries are not recognised","articleBody":"### Version\r\n\r\n1.25.0\r\n\r\n### What happened?\r\n\r\nSQLite requires a `PRAGMA` query to enable foreign key constraints. Unfortunately, sqlc does not seem to recognise `PRAGMA` as a valid query, and actually collects everything until the first query it does recognise. Let me illustrate. In the `queries.sql` below, there are three named `PRAGMA` queries followed by an `INSERT`. Instead of generating four query functions, sqlc actually just creates one:\r\n\r\n```go\r\n\r\nconst pragmaForeignKeysEnable = `-- name: PragmaForeignKeysEnable :exec\r\n\r\nPRAGMA foreign_keys = 1;\r\n\r\nPRAGMA foreign_keys = 0;\r\n\r\nPRAGMA foreign_keys;\r\n\r\n\r\n\r\nINSERT INTO jobs (\r\n  created_at,\r\n  uuid,\r\n  name,\r\n  job_type,\r\n  priority,\r\n  status,\r\n  activity,\r\n  settings,\r\n  metadata,\r\n  storage_shaman_checkout_id\r\n)\r\nVALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\r\n`\r\n\r\ntype PragmaForeignKeysEnableParams struct {\r\n\tCreatedAt               time.Time\r\n\tUuid                    string\r\n\tName                    string\r\n\tJobType                 string\r\n\tPriority                int64\r\n\tStatus                  string\r\n\tActivity                string\r\n\tSettings                json.RawMessage\r\n\tMetadata                json.RawMessage\r\n\tStorageShamanCheckoutID sql.NullString\r\n}\r\n\r\n// PRAGMA queries\r\n//\r\n// Jobs / Tasks queries\r\nfunc (q *Queries) PragmaForeignKeysEnable(ctx context.Context, arg PragmaForeignKeysEnableParams) error {\r\n\t_, err := q.db.ExecContext(ctx, pragmaForeignKeysEnable,\r\n\t\targ.CreatedAt,\r\n\t\targ.Uuid,\r\n\t\targ.Name,\r\n\t\targ.JobType,\r\n\t\targ.Priority,\r\n\t\targ.Status,\r\n\t\targ.Activity,\r\n\t\targ.Settings,\r\n\t\targ.Metadata,\r\n\t\targ.StorageShamanCheckoutID,\r\n\t)\r\n\treturn err\r\n}\r\n```\r\n\r\nAs you can see, instead of using `-- name: ...` as query boundary, sqlc groups everything together until the `INSERT`.\r\n\r\n\r\n\r\n### Relevant log output\r\n\r\n_No response_\r\n\r\n### Database schema\r\n\r\n```sql\r\nCREATE TABLE jobs (\r\n  id integer NOT NULL,\r\n  created_at datetime NOT NULL,\r\n  updated_at datetime,\r\n  uuid varchar(36) UNIQUE DEFAULT '' NOT NULL,\r\n  name varchar(64) DEFAULT '' NOT NULL,\r\n  job_type varchar(32) DEFAULT '' NOT NULL,\r\n  priority smallint DEFAULT 0 NOT NULL,\r\n  status varchar(32) DEFAULT '' NOT NULL,\r\n  activity varchar(255) DEFAULT '' NOT NULL,\r\n  settings jsonb NOT NULL,\r\n  metadata jsonb NOT NULL,\r\n  delete_requested_at datetime,\r\n  storage_shaman_checkout_id varchar(255) DEFAULT '',\r\n  PRIMARY KEY (id),\r\n)\r\n```\r\n\r\n\r\n### SQL queries\r\n\r\n```sql\r\n-- PRAGMA queries\r\n--\r\n\r\n-- name: PragmaForeignKeysEnable :exec\r\nPRAGMA foreign_keys = 1;\r\n\r\n-- name: PragmaForeignKeysDisable :exec\r\nPRAGMA foreign_keys = 0;\r\n\r\n-- name: PragmaForeignKeysGet :one\r\nPRAGMA foreign_keys;\r\n\r\n\r\n-- Jobs / Tasks queries\r\n--\r\n\r\n-- name: CreateJob :exec\r\nINSERT INTO jobs (\r\n  created_at,\r\n  uuid,\r\n  name,\r\n  job_type,\r\n  priority,\r\n  status,\r\n  activity,\r\n  settings,\r\n  metadata,\r\n  storage_shaman_checkout_id\r\n)\r\nVALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );\r\n```\r\n\r\n\r\n### Configuration\r\n\r\n_No response_\r\n\r\n### Playground URL\r\n\r\nhttps://play.sqlc.dev/p/ce20411be4624a0295c2e51b8eb075a4e1069ac3d6951778cd6a54f032831a3c\r\n\r\n### What operating system are you using?\r\n\r\nWindows\r\n\r\n### What database engines are you using?\r\n\r\nSQLite\r\n\r\n### What type of code are you generating?\r\n\r\nGo","author":{"url":"https://github.com/sybrenstuvel","@type":"Person","name":"sybrenstuvel"},"datePublished":"2024-03-02T17:22:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/3237/sqlc/issues/3237"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5397e587-b5aa-45d6-64e5-9a65f0aeb13a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8942:1DCECA:41BD27:5E95D3:6A50F9B2
html-safe-nonce3711e19b4e0754d77b5550296f29694ff05a35b5006c68d59fbd9196a8050c85
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTQyOjFEQ0VDQTo0MUJEMjc6NUU5NUQzOjZBNTBGOUIyIiwidmlzaXRvcl9pZCI6IjU3MDExMTEzNzI1NTg5NTY5NzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacda8358a11bf17556c42c746f336ab8d11952ce8855790282bde5f93432f43ea2
hovercard-subject-tagissue:2164897591
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlc-dev/sqlc/3237/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5494b5241039112f0da424f5d71c60753181b9bc7485ee2050ece4aaecdcd886/sqlc-dev/sqlc/issues/3237
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5494b5241039112f0da424f5d71c60753181b9bc7485ee2050ece4aaecdcd886/sqlc-dev/sqlc/issues/3237
og:image:altVersion 1.25.0 What happened? SQLite requires a PRAGMA query to enable foreign key constraints. Unfortunately, sqlc does not seem to recognise PRAGMA as a valid query, and actually collects everyth...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesybrenstuvel
hostnamegithub.com
expected-hostnamegithub.com
None5266e58c17a510c403505cc811606465e90a881d2007ee7df1c4800d5c659838
turbo-cache-controlno-preview
go-importgithub.com/sqlc-dev/sqlc git https://github.com/sqlc-dev/sqlc.git
octolytics-dimension-user_id136738596
octolytics-dimension-user_loginsqlc-dev
octolytics-dimension-repository_id193160679
octolytics-dimension-repository_nwosqlc-dev/sqlc
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id193160679
octolytics-dimension-repository_network_root_nwosqlc-dev/sqlc
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8d836581d020676cc0ef4a83cd2fe17e4af02c3d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/sqlc-dev/sqlc/issues/3237#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fissues%2F3237
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fissues%2F3237
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=sqlc-dev%2Fsqlc
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3237
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3237
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3237
Please reload this pagehttps://github.com/sqlc-dev/sqlc/issues/3237
sqlc-dev https://github.com/sqlc-dev
sqlchttps://github.com/sqlc-dev/sqlc
Notifications https://github.com/login?return_to=%2Fsqlc-dev%2Fsqlc
Fork 1.1k https://github.com/login?return_to=%2Fsqlc-dev%2Fsqlc
Star 18k https://github.com/login?return_to=%2Fsqlc-dev%2Fsqlc
Code https://github.com/sqlc-dev/sqlc
Issues 597 https://github.com/sqlc-dev/sqlc/issues
Pull requests 106 https://github.com/sqlc-dev/sqlc/pulls
Discussions https://github.com/sqlc-dev/sqlc/discussions
Actions https://github.com/sqlc-dev/sqlc/actions
Projects https://github.com/sqlc-dev/sqlc/projects
Security and quality 0 https://github.com/sqlc-dev/sqlc/security
Insights https://github.com/sqlc-dev/sqlc/pulse
Code https://github.com/sqlc-dev/sqlc
Issues https://github.com/sqlc-dev/sqlc/issues
Pull requests https://github.com/sqlc-dev/sqlc/pulls
Discussions https://github.com/sqlc-dev/sqlc/discussions
Actions https://github.com/sqlc-dev/sqlc/actions
Projects https://github.com/sqlc-dev/sqlc/projects
Security and quality https://github.com/sqlc-dev/sqlc/security
Insights https://github.com/sqlc-dev/sqlc/pulse
PRAGMA queries are not recognisedhttps://github.com/sqlc-dev/sqlc/issues/3237#top
📚 sqlitehttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Abooks%3A%20sqlite%22
enhancementNew feature or requesthttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/sybrenstuvel
sybrenstuvelhttps://github.com/sybrenstuvel
on Mar 2, 2024https://github.com/sqlc-dev/sqlc/issues/3237#issue-2164897591
https://play.sqlc.dev/p/ce20411be4624a0295c2e51b8eb075a4e1069ac3d6951778cd6a54f032831a3chttps://play.sqlc.dev/p/ce20411be4624a0295c2e51b8eb075a4e1069ac3d6951778cd6a54f032831a3c
📚 sqlitehttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Abooks%3A%20sqlite%22
enhancementNew feature or requesthttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.