Open
Description
What happened?
Error
$ RUST_BACKTRACE=full sqruff fix schema.sql
thread 'main' panicked at /build/rustc-1.86.0-src/library/alloc/src/slice.rs:569:23:
capacity overflow
stack backtrace:
0: 0x55e6b1aede7e - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9edbd6e38a8b0805
1: 0x55e6b110da13 - core::fmt::write::h7b1248e5e0c79c78
2: 0x55e6b1abdee2 - std::io::Write::write_fmt::h5e301665499081bf
3: 0x55e6b1aeb49e - std::panicking::rust_panic_with_hook::h100726ba9570b85a
4: 0x55e6b1aee4d5 - std::panicking::begin_panic_handler::{{closure}}::h141712493bfacf0c
5: 0x55e6b1aee469 - std::sys::backtrace::__rust_end_short_backtrace::h891003731531c924
6: 0x55e6b1aead9c - rust_begin_unwind
7: 0x55e6b105c57f - core::panicking::panic_fmt::h1df68d570cb2382b
8: 0x55e6b10c5306 - alloc::raw_vec::capacity_overflow::hf1479509b58d13f4
9: 0x55e6b1243514 - alloc::slice::<impl [T]>::repeat::hb96153c26571915d
10: 0x55e6b1240c5c - sqruff_lib::utils::reflow::elements::ReflowPoint::respace_point::hbb138f28cf5e8985
11: 0x55e6b123ac48 - sqruff_lib::utils::reflow::sequence::ReflowSequence::respace::hbd221e2b80e765f1
12: 0x55e6b12ce1b7 - sqruff_lib::core::rules::base::Rule::crawl::h79bcc37746c0feae
13: 0x55e6b133db7e - sqruff_lib::core::linter::core::Linter::lint_fix_parsed::h6ec4c65cf9bfcea2
14: 0x55e6b1339d9b - sqruff_lib::core::linter::core::Linter::lint_parsed::hbef4a49e41cb8827
15: 0x55e6b1353e30 - rayon::iter::plumbing::bridge_producer_consumer::helper::ha96aa97fd1eca95d
16: 0x55e6b135011b - sqruff_lib::core::linter::core::Linter::lint_paths::hbabe34a18564a02d
17: 0x55e6b1084cfb - sqruff::commands_fix::run_fix::hc4973e65fd8847ee
18: 0x55e6b108c63c - sqruff::main::h42e4c11f3a3039c0
19: 0x55e6b107e0e3 - std::sys::backtrace::__rust_begin_short_backtrace::h86d54453d31f82d8
20: 0x55e6b1093f63 - main
21: 0x7f8a74c2a47e - __libc_start_call_main
22: 0x7f8a74c2a539 - __libc_start_main_impl
23: 0x55e6b1077ee5 - _start
24: 0x0 - <unknown>
== [schema.sql] FAIL
L: 1 | P: 1 | ???? | Unexpected exception. Could you open an issue at
| https://github.com/quarylabs/sqruff
Are you sure you wish to attempt to fix these? [Y/n] ...
Configuration
[sqlfluff]
dialect = postgres
[sqlfluff:layout:type:column_constraint_segment]
spacing_before = align
align_within = statement
align_scope = file
Schema
-- Schema for Users
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT (now() AT TIME ZONE 'utc')
);
-- Schema for Posts
CREATE TABLE posts (
post_id SERIAL PRIMARY KEY,
user_id INT NOT NULL,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT (now() AT TIME ZONE 'utc'),
updated_at TIMESTAMP WITHOUT TIME ZONE,
FOREIGN KEY (user_id) REFERENCES users (user_id)
);
-- Schema for Comments
CREATE TABLE comments (
comment_id SERIAL PRIMARY KEY,
post_id INT NOT NULL,
user_id INT NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT (now() AT TIME ZONE 'utc'),
FOREIGN KEY (post_id) REFERENCES posts (post_id),
FOREIGN KEY (user_id) REFERENCES users (user_id)
);
Version
$ sqruff --version
sqruff 0.25.28
Checked in Playground
- I have checked this bug in the playground.