Re: Determine if range list contains specified integer

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Determine if range list contains specified integer
Дата
Msg-id CAKFQuwY8b2PtOPHe_ue-9TMDw_Rv6DtyRzRFXjYYhTC83uHyFg@mail.gmail.com
обсуждение исходный текст
Ответ на Determine if range list contains specified integer  (Andrus <kobruleht2@hot.ee>)
Список pgsql-general
On Fri, May 27, 2022 at 9:19 AM Andrus <kobruleht2@hot.ee> wrote:

Product type table contains product types. Some ids may missing :


    create table artliik (liiginrlki char(3) primary key);


As an aside, don't use the "character" data type:

    create table strings ( id char(100) primary key, kirjeldLku chr(200) );
    insert into strings values ('item1', '1,4-5' );
    insert into strings values ('item2', '1,2,3,6-9,23-44,45' );


Those are ranges.  PostgreSQL has actual range types.  Using them instead of using text should make life considerably easier.

If you can go with PostgreSQL v14 you get access to multirange types.

Absent that you probably can use PostgreSQL array of ranges to accomplish a similar goal.

David J.

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Determine if range list contains specified integer
Следующее
От: Sándor Daku
Дата:
Сообщение: Re: Determine if range list contains specified integer