Re: UUID as primary key

Поиск
Список
Период
Сортировка
От Harald Armin Massa
Тема Re: UUID as primary key
Дата
Msg-id 7be3f35d0608220814p25e08fedt479070e2f766ef90@mail.gmail.com
обсуждение исходный текст
Ответ на Re: UUID as primary key  (Vance Maverick <vmaverick@pgp.com>)
Ответы Re: UUID as primary key
Список pgsql-general
Vance,

nice that it was of help.

(When going from Java to the database, for example, it's
easiest to compose the value directly into the SQL query rather than
using a parameter.)  This seems quite viable.

Please allow me to recommend to you to NOT go this seemingly easy way. I went there myself (but did it in Python and PHP) some years ago, when I was young and needed the money.

Those "put Data into your SQL Statements with String Substitution" is easy to get working in the first step; but gets very very hard to keep correct in the long run. Please google up topics like "SQL injection" and "escaping characters for SQL" - it is a source of endless frustration.


Another tip to deal with GUIDs in applications:
Because GUIDs are rather long when expressed in base16 (hexadecimal notion), I made a transformer to Base62, using numbers and all regular letters. That shortens the typical GUID from 32chars to 21chars.

Harald
 

--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstraße 202b
70197 Stuttgart
0173/9409607
-
Let's set so double the killer delete select all.

В списке pgsql-general по дате отправления:

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: Queries joining views
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Queries joining views