Title: Materialized View does not enforce columns names - 1.13.0 · Issue #1545 · sqlc-dev/sqlc · GitHub
Open Graph Title: Materialized View does not enforce columns names - 1.13.0 · Issue #1545 · sqlc-dev/sqlc
X Title: Materialized View does not enforce columns names - 1.13.0 · Issue #1545 · sqlc-dev/sqlc
Description: Version Other What happened? When compiling, sqlc does not verify that the columns exist in the mat view. See the schema below and the query, the query compiles fine, but running that on the DB throws column "earned" does not exist Relev...
Open Graph Description: Version Other What happened? When compiling, sqlc does not verify that the columns exist in the mat view. See the schema below and the query, the query compiles fine, but running that on the DB thr...
X Description: Version Other What happened? When compiling, sqlc does not verify that the columns exist in the mat view. See the schema below and the query, the query compiles fine, but running that on the DB thr...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/1545
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Materialized View does not enforce columns names - 1.13.0","articleBody":"### Version\n\nOther\n\n### What happened?\n\nWhen compiling, sqlc does not verify that the columns exist in the mat view.\r\n\r\nSee the schema below and the query, the query compiles fine, but running that on the DB throws `column \"earned\" does not exist`\n\n### Relevant log output\n\n_No response_\n\n### Database schema\n\n```sql\nCREATE TABLE kpis (\r\n ts TIMESTAMPTZ,\r\n event_id TEXT NOT NULL,\r\n svc TEXT NOT NULL,\r\n stage TEXT,\r\n region TEXT,\r\n instance TEXT,\r\n player_id TEXT,\r\n slip_id TEXT,\r\n game TEXT,\r\n data JSONB NOT NULL\r\n);\r\n\r\nCREATE MATERIALIZED VIEW IF NOT EXISTS ten_day_kills\r\nWITH (timescaledb.continuous) AS\r\nSELECT time_bucket(INTERVAL '10 day', ts) AS bucket,\r\n COUNT(*) AS kill_count,\r\n (data-\u003e\u003e'winning_player_id')::TEXT pid\r\nFROM kpis\r\nWHERE event_id = 'player.defeated'\r\nGROUP BY pid, bucket\r\n;\n```\n\n\n### SQL queries\n\n```sql\nSELECT COALESCE(SUM(earned), 0) as total_earned\r\nFROM ten_day_kills\r\nWHERE pid = @player_id\r\n;\n```\n\n\n### Configuration\n\n```yaml\nversion: 1\r\npackages:\r\n - path: \"tsdb\"\r\n name: \"tsdb\"\r\n engine: \"postgresql\"\r\n schema: \"schema.sql\"\r\n queries: \"./queries/\"\r\n sql_package: \"pgx/v4\"\n```\n\n\n### Playground URL\n\nhttps://play.sqlc.dev/p/5fa2f34d645dba3e876ff1d17c42a8927cfcb1b3885755abba3604831d8e1010\n\n### What operating system are you using?\n\nmacOS\n\n### What database engines are you using?\n\nPostgreSQL\n\n### What type of code are you generating?\n\nGo","author":{"url":"https://github.com/danthegoodman1","@type":"Person","name":"danthegoodman1"},"datePublished":"2022-04-11T19:50:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1545/sqlc/issues/1545"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:892f8add-7288-d09d-a207-18c19ceddaa7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8BA2:371DAA:BBA75E:BF1D3C:6A5127E6 |
| html-safe-nonce | c8ee32fd1f89073d347d5f68677593744629abd7465f1cc07b589fcfabee53f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkEyOjM3MURBQTpCQkE3NUU6QkYxRDNDOjZBNTEyN0U2IiwidmlzaXRvcl9pZCI6IjYwMTM4NDM1Mjc4MTcwNDU5OTAiLCJyZWdpb25fZWRnZSI6InNlYSIsInJlZ2lvbl9yZW5kZXIiOiJzZWEifQ== |
| visitor-hmac | 70bbc856d1e9ce77c17edf5ae6a07f7701f6a9f0824f089a0d021d4e2c433889 |
| hovercard-subject-tag | issue:1200458967 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlc-dev/sqlc/1545/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a94e4d4bea0b4e099ae57ff5abb47bbe93d9d69bbd491b8e0de4e6ae6976233c/sqlc-dev/sqlc/issues/1545 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a94e4d4bea0b4e099ae57ff5abb47bbe93d9d69bbd491b8e0de4e6ae6976233c/sqlc-dev/sqlc/issues/1545 |
| og:image:alt | Version Other What happened? When compiling, sqlc does not verify that the columns exist in the mat view. See the schema below and the query, the query compiles fine, but running that on the DB thr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | danthegoodman1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 689b683944b0d7f015d0e776452c970832fa81b82dc15284469b556ecced715b |
| turbo-cache-control | no-preview |
| go-import | github.com/sqlc-dev/sqlc git https://github.com/sqlc-dev/sqlc.git |
| octolytics-dimension-user_id | 136738596 |
| octolytics-dimension-user_login | sqlc-dev |
| octolytics-dimension-repository_id | 193160679 |
| octolytics-dimension-repository_nwo | sqlc-dev/sqlc |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 193160679 |
| octolytics-dimension-repository_network_root_nwo | sqlc-dev/sqlc |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 942b51ed3bd5feee3d5e2719f890a5fe286edbbb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width