edoceo / pg-ulid

ULID Functions for PostgreSQL
59 stars 0 forks source link

ulid data type not found postgresql-13 #1

Closed basaran closed 3 years ago

basaran commented 3 years ago

Hello,

Thank you for the extension. build.txt I followed the instruction to build the extension, but while creating the test table, I get this error

ERROR:  type "ulid" does not exist
LINE 2:  id ulid not null default ulid_create(),

SELECT ulid_create(); works fine, and returns the ulid.

Attached is the build log.

djbusby commented 3 years ago

Your build log looks fine; I think the issue is that you're expecting a data-type of "ulid" -- which this extension does not do. This extension really just provides the ulid_create() routine, which returns text only. Typically it's stored in a text type column (ie: char(26), varchar(26), or text). And your text data type choice may want some review -- this document: https://wiki.postgresql.org/wiki/Don%27t_Do_This -- has some strong opinions on text data types. (and for reference, when I'm using ulids, I'm storing them all in a char(26) column.

I'm going to close the ticket -- the fix is use text datatypes.

basaran commented 3 years ago

Hello, could you please update the readme file? Confusion was due to the example listed there:

CREATE TABLE ulid_pk_example (
    id ulid not null default ulid_create(),
    meta jsonb
);

which shows to create a column with the ulid type.

pksunkara commented 1 year ago

FWIW, I have made a new extension pgx_ulid that supports the data type and other features.