Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix documentation for adding field with default #253

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chdsbd
Copy link
Collaborator

@chdsbd chdsbd commented Aug 25, 2022

No description provided.

@@ -106,6 +106,7 @@ ALTER TABLE "core_recipe" ADD COLUMN "foo" integer DEFAULT uuid();
let ok_sql = r#"
-- NON-VOLATILE
ALTER TABLE "core_recipe" ADD COLUMN "foo" integer DEFAULT 10;
ALTER TABLE "account" ADD COLUMN "last_modified" timestamptz DEFAULT now();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

our code for checking volatility of functions doesn't work. now() is stable, while a function like random is volatile.

select
  proname,
  pronamespace::regnamespace,
  provolatile
from pg_proc
where proname = 'now'
  or proname = 'random';

I think we could hard code in a list of functions and then warn when we can't know for certain with a more detailed error message.

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.

1 participant