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
reserved word as a fieldname
Re: reserved word as a fieldname
Hello,
Since you are using the reserved word PostgreSQL, to solve the issue, please, set the TPgQuery.Options.QuoteNames property to True:
wbr, Oleg
Devart Team
Since you are using the reserved word PostgreSQL, to solve the issue, please, set the TPgQuery.Options.QuoteNames property to True:
Code: Select all
mMainQuery.Options.QuoteNames:=True;
Devart Team
Re: reserved word as a fieldname
Many, many thanks, that was the setting I had been looking for in vain
wbr, Uli
wbr, Uli
Re: reserved word as a fieldname
Hello,
Glad to see that the issue was resolved.
Feel free to contact us if you have any further questions about our products.
wbr, Oleg
Devart Team
Glad to see that the issue was resolved.
Feel free to contact us if you have any further questions about our products.
wbr, Oleg
Devart Team