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

No foreign keys displayed on sql server #440

Open
birkmose opened this issue Feb 12, 2024 · 1 comment
Open

No foreign keys displayed on sql server #440

birkmose opened this issue Feb 12, 2024 · 1 comment

Comments

@birkmose
Copy link

Given example DDL:

create table Test  (
        Id         uniqueidentifier not null primary key
)
go

create table TestRef  (
        Id         uniqueidentifier not null primary key
                   constraint FK_TestRef_Test_Id references Test,
)
go

I try to display TestRef - but do not observe the FK_TestRef_Test_Id as expected:

\d TestRef
           BASE TABLE "dbo.TestRef"
 Name |       Type       | Nullable | Default 
------+------------------+----------+---------
 Id   | uniqueidentifier | "NO"     |  
Indexes:
  "PK__TestRef__3214EC07AEDAFDCF" PRIMARY_KEY, UNIQUE, CLUSTERED (Id)

/* Would have  expected the foreign key to have been displayed here */
@kenshaw
Copy link
Member

kenshaw commented Feb 13, 2024

For reference:

pg:postgres@=> \d testref
      table "public.testref"
 Name | Type | Nullable | Default 
------+------+----------+---------
 id   | uuid | "NO"     |  
Indexes:
  "testref_pkey" PRIMARY_KEY, UNIQUE, btree (id)
Foreign-key constraints:
  "fk_testref_test_id" FOREIGN KEY (id) REFERENCES test(id) ON UPDATE NO ACTION ON DELETE NO ACTION

pg:postgres@=> 
$ psql postgres://postgres:P4ssw0rd@localhost
psql (16.1)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.

postgres=# \d testref
             Table "public.testref"
 Column | Type | Collation | Nullable | Default 
--------+------+-----------+----------+---------
 id     | uuid |           | not null | 
Indexes:
    "testref_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
    "fk_testref_test_id" FOREIGN KEY (id) REFERENCES test(id)

postgres=#

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

No branches or pull requests

2 participants