Re: IS it a good practice to use SERIAL as Primary Key?
От | Sander Steffann |
---|---|
Тема | Re: IS it a good practice to use SERIAL as Primary Key? |
Дата | |
Msg-id | 000d01c70f2e$98803600$64c8a8c0@balefirehome обсуждение исходный текст |
Ответ на | IS it a good practice to use SERIAL as Primary Key? ("carter ck" <carterck32@hotmail.com>) |
Ответы |
Re: IS it a good practice to use SERIAL as Primary Key?
|
Список | pgsql-general |
Hi, >> Sure, but the check digit does not need to be stored, as it can be >> regenerated on demand. The user interface just verifies the check >> digit, then throws it away. > > $ SET GEEZER > $ WRITE SYS$OUTPUT "THAT'S JUST EXTRA CYCLES WASTED BY THE" > $ WRITE SYS$OUTPUT "CLIENT. BETTER TO USE THEM FOR SOME OTHER" > $ WRITE SYS$OUTPUT "MORE PRODUCTIVE PURPOSE." > $ SET NOGEEZER > > That's the VAX/VMS in me oozing out. But seriously, regenerate it > on demand??? That's not how it works. This isn't a CRC or hash > function. Well, a check digit _is_ a kind of CRC. It is redundant information. For every number there is only one correct check digit, which means that the check digit does not add extra information to the number. So why store it? You will need to add the check digit on most (all?) output that is interpreted by humans. The software itself can just use the number itself (assuming you don't need to check the integrity of the software). If you store the number in the database, I would suggest making the db check the number on all input too. Otherwise you might end up with invalid data in the database. - Sander
В списке pgsql-general по дате отправления: