Skip to content

Conversation

youngsofun
Copy link
Member

@youngsofun youngsofun commented Mar 28, 2025

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

support nextval(a_seq_name) as field defaut value

CREATE SEQUENCE user_id_seq;

CREATE TABLE users (
  id INT DEFAULT NEXTVAL(user_id_seq),
  name VARCHAR
);

limition:

  1. not support expr with nextval as a part, e.g. nextval(seq1) + 1
  2. when copy into table the above user from stage files
    1. if copy into user(name)..., column id will be generated
    2. if copy into user(id, name)..., column id will come from data files, currently require every row contains column id

fixes #17616

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Mar 28, 2025
@youngsofun youngsofun merged commit fe274f4 into databendlabs:main Mar 30, 2025
144 of 148 checks passed
@BohuTANG
Copy link
Member

@soyeric128 Could you please add the new feature to the documentation? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature this PR introduces a new feature to the codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Support DEFAULT NEXTVAL for Sequences

3 participants