Skip to content

Commit

Permalink
Adding column constraint references test
Browse files Browse the repository at this point in the history
Signed-off-by: Emanuel Calvo <emanuel@ongres.com>
  • Loading branch information
3manuek committed Nov 16, 2021
1 parent 4852a38 commit e9ff8ee
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/JDBC/expected/BABEL-COLUMN-CONSTRAINT.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
USE master;
GO

CREATE SCHEMA [Babelfish_COLCONST];
GO

create table [Babelfish_COLCONST].[a] (
id int identity primary key,
texto varchar(50) NOT NULL
);
GO

create table [Babelfish_COLCONST].[b] (
id int identity primary key,
foreign_id int not null references [Babelfish_COLCONST].[a],
texto varchar(50) NOT NULL
);
GO

create table [Babelfish_COLCONST].[c] (
id int identity primary key,
foreign_id int not null,
foreign key(foreign_id) references [Babelfish_COLCONST].[a](id),
texto varchar(50) NOT NULL
);
GO

SET IDENTITY_INSERT [Babelfish_COLCONST].[a] ON;
insert into [Babelfish_COLCONST].[a](id,texto) values(1, 'some text');
SET IDENTITY_INSERT [Babelfish_COLCONST].[a] OFF;
GO
~~ROW COUNT: 1~~


insert into [Babelfish_COLCONST].[b](foreign_id, texto) values(1,'insert text');
GO
~~ROW COUNT: 1~~


insert into [Babelfish_COLCONST].[c](foreign_id, texto) values(1,'insert text');
GO
~~ROW COUNT: 1~~


DROP TABLE [Babelfish_COLCONST].[c];
DROP TABLE [Babelfish_COLCONST].[b];
DROP TABLE [Babelfish_COLCONST].[a];
DROP SCHEMA [Babelfish_COLCONST];
GO
43 changes: 43 additions & 0 deletions test/JDBC/input/BABEL-COLUMN-CONSTRAINT.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
USE master;
GO

CREATE SCHEMA [Babelfish_COLCONST];
GO

create table [Babelfish_COLCONST].[a] (
id int identity primary key,
texto varchar(50) NOT NULL
);
GO

create table [Babelfish_COLCONST].[b] (
id int identity primary key,
foreign_id int not null references [Babelfish_COLCONST].[a],
texto varchar(50) NOT NULL
);
GO

create table [Babelfish_COLCONST].[c] (
id int identity primary key,
foreign_id int not null,
foreign key(foreign_id) references [Babelfish_COLCONST].[a](id),
texto varchar(50) NOT NULL
);
GO

SET IDENTITY_INSERT [Babelfish_COLCONST].[a] ON;
insert into [Babelfish_COLCONST].[a](id,texto) values(1, 'some text');
SET IDENTITY_INSERT [Babelfish_COLCONST].[a] OFF;
GO

insert into [Babelfish_COLCONST].[b](foreign_id, texto) values(1,'insert text');
GO

insert into [Babelfish_COLCONST].[c](foreign_id, texto) values(1,'insert text');
GO

DROP TABLE [Babelfish_COLCONST].[c];
DROP TABLE [Babelfish_COLCONST].[b];
DROP TABLE [Babelfish_COLCONST].[a];
DROP SCHEMA [Babelfish_COLCONST];
GO

0 comments on commit e9ff8ee

Please sign in to comment.