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

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to