Files
mono/mcs/class/System.Data.Linq/examples/DbLinq.Pgsql.Example/sql/createDB_Andrus.sql
T
Jonathan Pryor 51fe9f0e89 * Makefile: Also rsync dblinq2007/examples sources.
* build/DbLinq.Sqlite_test_mono_strict.dll.sources: Added; .sources
	  file to build build/DbLinq.Sqlite_test_mono_strict.dll, the
	  "end-to-end" unit tests for SQLite using Mono.Data.Sqlite.
	* build/Makefile: Added; builds all "end-to-end" unit tests.
	* examples/**/*: Sync with DbLinq r1217; includes sources needed for
	  end-to-end tests located in 'build'.

svn path=/trunk/mcs/; revision=141365
2009-09-04 20:50:26 +00:00

87 lines
2.7 KiB
SQL

--############################################################
-- this database contains pathological cases discovered by Andrus (Tallinn, Estonia)
--####################################################################
--## create database
--####################################################################
DROP DATABASE IF EXISTS Andrus;
CREATE DATABASE Andrus WITH OWNER = "LinqUser";
\connect andrus
--####################################################################
--## create tables
--####################################################################
DROP TABLE t1 CASCADE;
DROP TABLE t2;
DROP TABLE t3;
DROP DOMAIN ebool;
--# problem 1. foreign key relation generates duplicate propery if property exists.
--# problem 2. Column name 'private' causes error
CREATE TABLE t1 ( private int primary key);
CREATE TABLE t2 ( f1 int references t1,
f2 int references t1 );
CREATE DOMAIN ebool AS bool DEFAULT false NOT NULL;
--# problem 3. GetHashCode() does not check null ids for reference types
--# problem 4. pgsql domain types are not recognized in mappings ('ebool' above)
CREATE TABLE t3 ( t3ID varchar(5) primary key,
my_ebool ebool,
t3 integer); --check for 'Content' field
/*
CREATE TABLE t4
ALTER TABLE t4 ALTER kasutaja SET NOT NULL,
ALTER t4 SET NOT NULL,
ADD constraint t4_kasutaja_firmanr_unique
UNIQUE (t4,kasutaja,firmanr);
--this causes exception in sqlmetal:
--Missing data from 'constraint_column_usage' for foreign key
--kasgrupp_kasutaja_firmanr_unique
*/
create table tCompositePK
(
f1 int,
f2 varchar(5),
f3 int,
primary key(f1,f2)
);
-- there was a bug where this table could not be updated - quotes missing in the UPDATE statement around the PK.
create table char_pk ( col1 char primary key, val1 int);
-- this is for testing of vertical Partitioning / Discriminator.
create table Employee
(
employeeID SERIAL NOT NULL,
employeeType int NOT NULL,
employeeName varchar(99),
startDate date NULL,
PRIMARY KEY(employeeID)
);
--####################################################################
--## make sure permissions are set
--####################################################################
grant all on char_pk to "LinqUser";
grant all on employee to "LinqUser";
grant all on t1 to "LinqUser";
grant all on t2 to "LinqUser";
grant all on t3 to "LinqUser";
grant all on tcompositepk to "LinqUser";
INSERT INTO Employee (employeeType, employeeName) VALUES (0, 'Pavel');
INSERT INTO Employee (employeeType, employeeName) VALUES (1, 'Piotr');
INSERT INTO Employee (employeeType, employeeName) VALUES (1, 'Jana');
INSERT INTO Employee (employeeType, employeeName) VALUES (2, 'Ladislav');
COMMIT;