reserved word as a fieldname
Posted: Thu 23 Apr 2020 13:24
Hello,
I have a table in which a field is called "offset". But since offset is a reserved word in PostGreSQL, I now have a problem when I want to assign a value to this field. In the debugger, I have the following picture before I want to post the record:
mMainQuery.Fields[0].Name 'id'
mMainQuery.Fields[0].Value 'TEST'
mMainQuery.Fields[1].Name 'remark'
mMainQuery.Fields[1].Value Null
mMainQuery.Fields[2].Name 'collection'
mMainQuery.Fields[2].Value Null
mMainQuery.Fields[3].Name 'time_field'
mMainQuery.Fields[3].Value Null
mMainQuery.Fields[4].Name 'offset'
mMainQuery.Fields[4].Value 300
mMainQuery.Fields[5].Name 'repeat_interval'
mMainQuery.Fields[5].Value Null
mMainQuery.Fields[6].Name 'stop_repeat_offset'
mMainQuery.Fields[6].Value Null
mMainQuery.Fields[7].Name 'repeat_on_field_change'
mMainQuery.Fields[7].Value False
My problem is the name of field 4 "offset". At the post I get this exception:
'syntax error at or near "offset"'
Can I set somewhere that the field names are put in single or double quotes? I cannot change the table.
wbr, Uli
I have a table in which a field is called "offset". But since offset is a reserved word in PostGreSQL, I now have a problem when I want to assign a value to this field. In the debugger, I have the following picture before I want to post the record:
mMainQuery.Fields[0].Name 'id'
mMainQuery.Fields[0].Value 'TEST'
mMainQuery.Fields[1].Name 'remark'
mMainQuery.Fields[1].Value Null
mMainQuery.Fields[2].Name 'collection'
mMainQuery.Fields[2].Value Null
mMainQuery.Fields[3].Name 'time_field'
mMainQuery.Fields[3].Value Null
mMainQuery.Fields[4].Name 'offset'
mMainQuery.Fields[4].Value 300
mMainQuery.Fields[5].Name 'repeat_interval'
mMainQuery.Fields[5].Value Null
mMainQuery.Fields[6].Name 'stop_repeat_offset'
mMainQuery.Fields[6].Value Null
mMainQuery.Fields[7].Name 'repeat_on_field_change'
mMainQuery.Fields[7].Value False
My problem is the name of field 4 "offset". At the post I get this exception:
'syntax error at or near "offset"'
Can I set somewhere that the field names are put in single or double quotes? I cannot change the table.
wbr, Uli