Skip to content

feat: CREATE TABLE LIKE source_table#18

Merged
tianzhou merged 1 commit intomainfrom
create-table-like-template
Sep 11, 2025
Merged

feat: CREATE TABLE LIKE source_table#18
tianzhou merged 1 commit intomainfrom
create-table-like-template

Conversation

@tianzhou
Copy link
Contributor

@tianzhou tianzhou commented Sep 11, 2025

Fix #13

Copilot AI review requested due to automatic review settings September 11, 2025 08:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for CREATE TABLE LIKE statements in PostgreSQL schema management. It enables tables to inherit structure from existing tables using the LIKE clause with various options (INCLUDING ALL, INCLUDING DEFAULTS, etc.).

  • Implements parsing and expansion of CREATE TABLE LIKE clauses
  • Adds support for copying columns, constraints, indexes, and comments from source tables
  • Generates appropriate DDL that expands LIKE clauses into explicit column definitions

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

File Description
internal/ir/parser.go Adds constants, parsing logic, and expansion functionality for LIKE clauses
internal/ir/ir.go Defines LikeClause struct and adds LikeClauses field to Table
internal/diff/table.go Updates DDL generation to handle LIKE clauses in CREATE TABLE statements
testdata files Test data showing expected behavior for CREATE TABLE LIKE expansion

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tianzhou tianzhou force-pushed the create-table-like-template branch 2 times, most recently from f60a90d to ddba900 Compare September 11, 2025 09:42
@tianzhou tianzhou force-pushed the create-table-like-template branch from ddba900 to 591748b Compare September 11, 2025 09:44
@tianzhou tianzhou merged commit 3fee909 into main Sep 11, 2025
2 checks passed
@tianzhou tianzhou deleted the create-table-like-template branch September 11, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for like operator in table schemas

2 participants