Skip to content

Deferrable foreign keys for PostgresSQL backend#1057

Open
quffaro wants to merge 5 commits intomainfrom
cm/sql-improvement
Open

Deferrable foreign keys for PostgresSQL backend#1057
quffaro wants to merge 5 commits intomainfrom
cm/sql-improvement

Conversation

@quffaro
Copy link
Copy Markdown
Collaborator

@quffaro quffaro commented Feb 17, 2026

Closes #1030 and #1034

@quffaro quffaro added enhancement New feature or request frontend TypeScript frontend and Rust-wasm integrations core Rust core for categorical logic and general computation labels Feb 17, 2026
@quffaro quffaro force-pushed the cm/sql-improvement branch 4 times, most recently from dd4e2ca to 0d06d77 Compare February 21, 2026 03:10
@quffaro quffaro marked this pull request as ready for review February 21, 2026 03:10
@quffaro quffaro requested a review from kasbah as a code owner February 21, 2026 03:10
flex-direction: row;
}

.headerContainer > * {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is necessary

@quffaro quffaro force-pushed the cm/sql-improvement branch 3 times, most recently from ffe31d8 to 06efcb8 Compare February 23, 2026 18:43
Copy link
Copy Markdown
Member

@epatters epatters left a comment

Choose a reason for hiding this comment

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

Thanks Matt! I left a first round of questions and comments on the toposort alg.

I see lots of remaining TODOs, so maybe this wasn't intended to be reviewed yet?

Comment thread packages/catlog/src/one/graph_algorithms.rs Outdated
pub struct ToposortData<G>
where
G: FinGraph,
G::V: Hash + std::fmt::Debug + Clone,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's considered bad practice to put trait bounds on the struct itself. Put them only on the impls. See https://stackoverflow.com/a/66369912

Moreover, you should make the type parameter be V (vertices) rather than G (graph).

Comment thread packages/catlog/src/one/graph_algorithms.rs Outdated
type ToposortResult<G> = Result<ToposortData<G>, ToposortError<G>>;

/// Implementation of topological sort which throws an error when it encounters a cycle.
pub fn toposort_strict<G>(graph: &G) -> ToposortResult<G>
Copy link
Copy Markdown
Member

@epatters epatters Feb 24, 2026

Choose a reason for hiding this comment

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

I find this docstring confusing: in Rust, errors aren't thrown, exactly. Does this mean that an Err variant is returned when a cycle is encountered?

}

/// Implementation of topological sort which does not throw an error when it encounters cycle.
pub fn toposort_lenient<G>(graph: &G) -> ToposortResult<G>
Copy link
Copy Markdown
Member

@epatters epatters Feb 24, 2026

Choose a reason for hiding this comment

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

Does this mean that it always returns the Ok variant?

Comment thread packages/catlog/src/one/graph_algorithms.rs Outdated
Comment thread packages/catlog/src/one/graph_algorithms.rs Outdated
@quffaro quffaro force-pushed the cm/sql-improvement branch 7 times, most recently from e3cf2cd to d189b57 Compare March 24, 2026 21:59
@quffaro quffaro requested a review from jmoggr as a code owner March 24, 2026 21:59
Copy link
Copy Markdown
Member

@kasbah kasbah left a comment

Choose a reason for hiding this comment

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

Left some comments about syntax highlighting.

Comment thread packages/frontend/src/stdlib/analyses/sql.tsx Outdated
Comment on lines +12 to +17
import styles from "../styles.module.css";
// eslint-disable-next-line import/no-unassigned-import
import "prismjs/components/prism-sql";
// eslint-disable-next-line import/no-unassigned-import
import "prismjs/themes/prism.min.css";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be nice to add have CodeView component so that the next person can just import and use that without worrying about global imports.

It seems possible, if a little tricky, to support all languages but lazily loaded. Maybe PrismJS isn't the best to do this in a clean way. My first thought was something tree-sitter based but a quick search didn't turn up any obvious solution.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm willing to work on that in a separate PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still for this PR what is currently here could go in a CodeView component and it only supports SQL.

@quffaro quffaro force-pushed the cm/sql-improvement branch 4 times, most recently from d03a64a to fdd4db3 Compare March 31, 2026 15:24
@quffaro quffaro requested review from epatters and kasbah March 31, 2026 18:46
@quffaro quffaro force-pushed the cm/sql-improvement branch 2 times, most recently from 2fcba2f to 9f07cba Compare March 31, 2026 18:57
@quffaro quffaro force-pushed the cm/sql-improvement branch from 9f07cba to 59b5a56 Compare April 13, 2026 16:43
@quffaro quffaro force-pushed the cm/sql-improvement branch 3 times, most recently from a52b6fa to c7446d0 Compare April 13, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Rust core for categorical logic and general computation enhancement New feature or request frontend TypeScript frontend and Rust-wasm integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate SQL schemas with cycles

3 participants