[Lazarus] Inserting enum type into Postgresql
"Leonardo M. Ramé"
l.rame at griensu.com
Fri May 15 16:54:49 CEST 2015
Hi, I need to insert a value into a custom type column in a PostgreSql
database.
The type was created using this:
create type doc_type as enum('pdf', 'rtf', 'html', 'doc', 'docx', 'xls',
'xlsx', 'txt');
To insert a field into a table with one column of that type, I use:
var
lQuery: TSqlQuery;
begin
...
lQuery.Sql.Text := 'insert into documents(document_name,
document_type) values(:name, :type)';
lQuery.ParamByName('type').AsString := 'txt';
...
I get "Primary Error: column "document_type" is of type doc_type but
expression is of type text". How can I cast this?.
Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the Lazarus
mailing list