SUP-140: fix MAXVALUE on snowflake-converted sequences.#38
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR repairs sequence MAXVALUE handling across the snowflake PostgreSQL extension. The change updates existing migration scripts to use a fixed 64-bit bigint maximum value ( ChangesSequence MAXVALUE Repair across Extension Versions
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@snowflake--2.4--2.5.sql`:
- Around line 269-274: The repair query currently only follows pg_depend rows
with deptype IN ('a','i') while convert_sequence_to_snowflake() also handles
non-owned sequences (deptype = 'n'); update the JOIN/filter that references
pg_depend (the clause using d.deptype IN ('a','i')) to include the same sequence
classes the conversion supports (e.g., add 'n' or otherwise match
convert_sequence_to_snowflake()'s logic) so the repair scan covers
non-owned/explicit nextval() sequences and avoids leaving stale max_value rows.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d2bbe946-d103-4d69-9523-8f4a461262f5
⛔ Files ignored due to path filters (2)
expected/conversion.outis excluded by!**/*.outexpected/maxvalue.outis excluded by!**/*.out
📒 Files selected for processing (11)
Makefilesnowflake--1.2--2.0.sqlsnowflake--2.0--2.2.sqlsnowflake--2.0.sqlsnowflake--2.2--2.3.sqlsnowflake--2.2.sqlsnowflake--2.3--2.4.sqlsnowflake--2.3.sqlsnowflake--2.4--2.5.sqlsnowflake.controlsql/maxvalue.sql
convert_sequence_to_snowflake() previously set MAXVALUE to (old last_value + 1). snowflake.nextval() bypasses MAXVALUE, so the sequence stored huge snowflake IDs against a tiny ceiling; pg_dump then captured both, and the restore failed with "setval: value <snowflake_id> is out of bounds for sequence ...". Fix in every embedded copy: ALTER SEQUENCE ... AS bigint NO CYCLE MAXVALUE 9223372036854775807. AS bigint keeps the fix safe for int4-backed serial sequences. Adds snowflake--2.4--2.5.sql which re-installs the corrected function and repairs already-converted sequences in existing databases. Bumps default_version to 2.5. Regression test sql/maxvalue.sql exercises the pg_dump setval path.
convert_sequence_to_snowflake() previously set MAXVALUE to (old last_value + 1). snowflake.nextval() bypasses MAXVALUE, so the sequence stored huge snowflake IDs against a tiny ceiling; pg_dump then captured both, and the restore failed with
"setval: value <snowflake_id> is out of bounds for sequence ...".
Fix in every embedded copy: ALTER SEQUENCE ... AS bigint NO CYCLE MAXVALUE 9223372036854775807. AS bigint keeps the fix safe for int4-backed serial sequences.
Adds snowflake--2.4--2.5.sql which re-installs the corrected function and repairs already-converted sequences in existing databases. Bumps default_version to 2.5. Regression test sql/maxvalue.sql exercises the pg_dump setval path.