In my database, the column cardid has not null set to true i.e. null not allowed.
When I run the following query in a delphi cum zeos TZQuery, the result field card_id0 has the property required as true which is correct but result field card_id1 doesn’t i.e. the quotation marks around card_id1 seem to mean give me the data but without constraints.
select c.id, c.cardid as card_id0, c.cardid as "card_id1"
from mydata c
Is this standard in sql?
What you are seeing, is the TZQuery not detecting the database constraint (not null) from the table/query metadata. This is only meaningful only if you add or update a record through the TZQuery component. You will still get an exception if you try to add or update a record with a null for
card_id0orcard_id1. The exception will be generated by the database rather than the component.Typically, quoting of field names (or aliases) only serves to allow illegal characters in a field name in a SQL query, i. e., having a space in a field name. There can be side effects to quoting field names, for example in Firebird/Interbase, quoting a field name will make it case sensitive while they are normally case insensitive.