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

Domain NN with a Default, column using Domain, Inserting data on the grid complains about column with null value #8483

Open
astrometrics opened this issue Feb 21, 2025 · 2 comments
Assignees
Labels

Comments

@astrometrics
Copy link

Please note that security bugs or issues should be reported to [email protected].

Describe the bug

A clear and concise description of what the bug is.
When using Domains with not null with a default value in the domain definition, insert data on the grid doesn´t work because it complains the column shouldn't be not null. The correct behaviour should be insert default value if the user didn't provide a value, with no "mandatory column" exception.
To Reproduce
as above
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. See the error
    Expected behavior
    The correct behaviour should be to insert default value if the user didn't provide a value, with no "mandatory column" exception.
    A clear and concise description of what you expected to happen.

Error message

If possible, include the full, unedited text of any error messages displayed.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows 10, OSX monterey]
  • Version: [e.g. 6.15]
  • Mode: [e.g Desktop or Server]
  • Browser (if running in server mode): [e.g. chrome, safari]
  • Package type: [e.g. RPM, DEB, Python, Container, etc.]

Additional context

Add any other context about the problem here.

@yogeshmahajan-1903
Copy link
Contributor

@astrometrics
Issue is not reproducible, can you please provide DDL for table and domain?

@astrometrics
Copy link
Author

astrometrics commented Feb 22, 2025

@astrometrics Issue is not reproducible, can you please provide DDL for table and domain?

Domain DDL:
CREATE DOMAIN public."DTNow"
AS timestamp without time zone
DEFAULT now();

Tables DDL:
CREATE TABLE domtest1 (
id serial NOT NULL primary key
,nm varchar(32) not null
,dob "DTNow" NOT NULL
);
CREATE TABLE domtest2 (
id serial NOT NULL primary key
,nm varchar(32) NOT NULL
,dob "DTNow"
);

grid insert on domtest1 fails, complaining about null value on dob
grid insert on domtest2 works

insert into domtest1 (nm) values ('name0'); --works, which is expected behaviour
insert into domtest2 (nm) values ('name0'); --works, which is expected behaviour

So grid behavior on domtest1 insert is wrong...

I suggest not to try to evaluate nulls or anything before submission... just let the server return success or error on commit... Also it would be nice just showing if a column is mandatory or not (grids are not showing NN), but not enforce filling the value before commit.

Further test:
If Domain with a default is made not null then both grid inserts fail, but sql inserts work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants