Powinieneś więc: 1. Zmienić typ na uuid (postgresql wspiera ten typ danych) 2. Walidować np. regexpem czy podane id przypomina UUID