Omnis variable and Postgres data type

Alex Clay aclay at mac.com
Wed Mar 30 10:03:29 UTC 2022


Hi Martin,

You could define this list as an enumerated type (https://www.postgresql.org/docs/current/datatype-enum.html <https://www.postgresql.org/docs/current/datatype-enum.html>), then define the column that uses these title with that type.

The PostgreSQL DAM lets you map schema columns to enums to help with generated SQL: https://omnis.net/developers/resources/onlinedocs/Programming/09serv.html#uuid-enum-and-xml-column-types <https://omnis.net/developers/resources/onlinedocs/Programming/09serv.html#uuid-enum-and-xml-column-types>

I wouldn't discount using a dedicated table to store these values. PostgreSQL is extremely efficient at joining in data. In my experience, a cleaner, normalized database layout is extremely valuable. You can always created a coded lookup table to allow for constraints.

id | type | value
--------------------
1 | title | Mr.
2 | title | Mrs.
3 | title | Dr.
etc.

I also recommend you avoid storing Omnis lists in the database. You can do this with a bytea type, but the data won't be accessible outside of Omnis and you'll lose any optimizations PostgreSQL can offer. At minimum convert the list to JSON before storing and back into an Omnis list when retrieving.

Alex

> On Mar 30, 2022, at 04:13, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> 
> Hi all,I have a list of titles; Mr. Mrs. Dr. Prof. Rev.It would be inefficient to store these in a separate table.A column is sufficient.
> Which is the likely postgres data type to store an Omnis variable of type list?
> Rgds,Martin. 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list