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

Fixed #20 column_constraint REFERENCES for accepting empty column list #35

Closed
wants to merge 2 commits into from

Conversation

3manuek
Copy link
Contributor

@3manuek 3manuek commented Nov 12, 2021

Signed-off-by: Emanuel Calvo emanuel@ongres.com

Description

It looks like that all tests are around either table constraints or by using references a(column). So I wrote a small test following @spencercw's concept:

create table a (
  id int identity primary key,
  texto varchar(50) NOT NULL
);

-- column_constraints
create table b (
  id int identity primary key,
  foreign_id int not null references a, -- no column specified
  texto varchar(50) NOT NULL
);
GO

SET IDENTITY_INSERT dbo.a ON;
GO

insert into a(id,texto) values(1, 'some text');
GO

insert into b(foreign_id, texto) values(1,'insert text');
GO
1> SELECT * FROM a;
2> SELECT * FROM b;
3> GO
id      texto
1       some text
(1 row affected)
id      foreign_id      texto
1       1       insert text
(1 row affected)

Tested also the FK reference functionality:

1> insert into b (foreign_id, texto) values (10,'fail?');
2> GO
Msg 547 (severity 16, state 1) from BABELFISH Line 1:
        "insert or update on table "b" violates foreign key constraint "b_foreign_id_fkey""

Issues Resolved

External references

Reported the issue to antlr grammars-v4.

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Emanuel Calvo <emanuel@ongres.com>
@3manuek 3manuek self-assigned this Nov 12, 2021
@3manuek 3manuek added the bug Something isn't working label Nov 12, 2021
@3manuek 3manuek linked an issue Nov 12, 2021 that may be closed by this pull request
1 task
@3manuek 3manuek added wip Work In Progress and removed wip Work In Progress labels Nov 12, 2021
@zli236
Copy link

zli236 commented Nov 12, 2021

Please add the test case to test/JDBC.

@3manuek 3manuek force-pushed the issue_20 branch 8 times, most recently from bdf217d to 046643d Compare November 15, 2021 13:08
zli236
zli236 previously approved these changes Nov 15, 2021
Signed-off-by: Emanuel Calvo <emanuel@ongres.com>
@3manuek
Copy link
Contributor Author

3manuek commented Nov 16, 2021

Please add the test case to test/JDBC.

Tests added and passing.

@3manuek
Copy link
Contributor Author

3manuek commented Mar 21, 2022

This has been merged from the internal repository, so I'm closing this and considering this done.

@3manuek 3manuek closed this Mar 21, 2022
@susanmdouglas-aws susanmdouglas-aws deleted the issue_20 branch May 17, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working In Review PR in review to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Can't create foreign key constraint
2 participants