Field+String with CREATE TABLE

How do you create a column that is both text field and string attribute?

Despite the new ‘stored’ text function, I think string attributes are still useful in some circumstances, like if want to sort, filter, or group etc.

CREATE TABLE testrt10 (title TEXT indexed, title STRING, category INT);

does not work. There never was rt_field_string (AFAIK!) but could do

rt_field = title
rt_attr_string = title

Seems like an option ‘string’ or just ‘attribute’ for TEXT type would be useful, unless missing something.

(actually, ‘string’ would be better, so can open way to also make it say ‘integer’ an option. Not very common, but I often store ‘year’ as both field and integer attribute, not string attribute. Field so users can search by year, but a integer attribute so can do range queries WHERE year BETWEEN 1990 and 1995 which is more tricky with string attributes.

could you create ticket at GitHub as currently at config-less mode you can not create field_string and I also field along with not string attribute was impossible too.

Could it be better to change INSERT schema to support query like this

INSERT INTO rt (title(year,base_name), gid, url) VALUES ( '1979', 11, '' )

to put source columns into different destinations?

As for field_string it is not clear what to put into result set if you define table CREATE TABLE testrt10 (title TEXT indexed stored, title STRING, category INT);

ie there will be both title columns for select * from testrt10 in result set one from stored field and another from attribute

1 Like

I was thinking more to be able to do

CREATE TABLE testrt10 (title TEXT indexed string, category INT);

ie add string as option to make a string attribute too. Then could specify either ‘stored’ or ‘string’(attribute) not both. I suppose could specify just ‘string’ as option, but seems pointless)

The bonus would be to do

 CREATE TABLE testrt10 (title TEXT indexed integer, category INT);

‘FIELD’ could perhaps be short hand for TEXT indexed.

CREATE TABLE testrt10 (title TEXT, year FIELD integer, category INT);

Changing insert doesn’t seem that useful, as woul still need to create two columns with different names