Purpose of the name of a foreign key

0

I'm creating tables for a system I'm developing and by entering the add foreign key part through the PostgreSQL 9.3.17 interface I noticed that it has the nome field to identify this key, I never paid much attention to it and always put the name of the key with the same name as the table column.

The addition screen with the input name looks like this:

Themomentakeyisaddeditsnameisdisplayedlikethis:

  • What is the purpose of the foreign key name?
  • What can you do in the future by neglecting to use this name?
asked by anonymous 01.08.2018 / 19:36

1 answer

0
  • What is the purpose of the foreign key name?

The intuitive foreign key name is to make it easier to understand relationships with other tables.

  • What can you do in the future by neglecting to use this name?

There are not many problems in neglecting to use this name, of course, it is good practice to always use names that make it easier to understand the relationship with other tables. To make it easier for you to understand another DBA that you may be servicing after you, just think of one example. You create multiple relationships with address tables, requests, and clients, and puts the name of the foreign key as ck, pk, te. Of course it is an inappropriate use of the foreign key name.

    
01.08.2018 / 19:43