Hello everyone! I want to know why attributes
field from tc_positions
table has type character varying(4000)
?
traccar=# \d tc_positions
Table "public.tc_positions"
Column | Type | Collation | Nullable | Default
-------------+-----------------------------+-----------+----------+----------------------------------
id | integer | | not null | generated by default as identity
protocol | character varying(128) | | |
deviceid | integer | | not null |
servertime | timestamp without time zone | | not null | now()
devicetime | timestamp without time zone | | not null |
fixtime | timestamp without time zone | | not null |
valid | boolean | | not null |
latitude | double precision | | not null |
longitude | double precision | | not null |
altitude | double precision | | not null |
speed | double precision | | not null |
course | double precision | | not null |
address | character varying(512) | | |
attributes | character varying(4000) | | |
accuracy | double precision | | not null | 0
network | character varying(4000) | | |
geofenceids | character varying(128) | | |
Since it stores a JSON object with additional message parameters (sensor values, etc.), why is it stored as a string and not a JSONB type? JSONB type would allow to perform much faster selections/filters/expressions with fields and values from this object directly through SQL queries. Is it possible to modify the table schema with this type when starting a new traccar server without breaking the functionality?
Because we support almost any SQL database, not just Postgres.
Hello everyone! I want to know why
attributes
field fromtc_positions
table has typecharacter varying(4000)
?Since it stores a JSON object with additional message parameters (sensor values, etc.), why is it stored as a string and not a JSONB type? JSONB type would allow to perform much faster selections/filters/expressions with fields and values from this object directly through SQL queries. Is it possible to modify the table schema with this type when starting a new traccar server without breaking the functionality?