XML Field type

I have the this error 'column "xpto" is of type xml but expression is of type text' how can I overcome it without changing the structure on databse.

What is your database type? PostgreSQL?

The type xml and yes is PostgreSQL.

We will do our best to provide fix for this in our upcoming release tomorrow.

Hmm... I see that we mapped properly xml to string according to our EF provider:
https://www.npgsql.org/doc/types/basic.html

Can you post this table definition?

CREATE TABLE public.flight_plan
(
id integer NOT NULL DEFAULT nextval('flight_plan_id_seq'::regclass),
drone_id integer NOT NULL,
drone_track_id character varying(50) COLLATE pg_catalog."default" NOT NULL,
submission_date timestamp without time zone NOT NULL,
start_date_time timestamp without time zone NOT NULL,
end_date_time timestamp without time zone NOT NULL,
geo_data xml NOT NULL,
status_id integer NOT NULL,
status_date timestamp without time zone NOT NULL,
approval_status_id integer,
region_id integer,
CONSTRAINT flight_plan_pkey PRIMARY KEY (id))
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

Just tried such field type however everything worked normally:



What's your Postgre version?

Sorry for the delay.

The version of posgresql is 9.6.10 and the error happens in a post, not on get. Upgrading to the last version did not solve the issue.

Below I am sending the error that appears in the output window.

dotnet: fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
** Failed executing DbCommand (54ms) [Parameters=[@p0='?' (DbType = Int32), @p1='?' (DbType = Int32), @p2='?', @p3='?' (DbType = DateTime), @p4='?', @p5='?' (DbType = Int32), @p6='?' (DbType = DateTime), @p7='?' (DbType = DateTime), @p8='?' (DbType = Int32), @p9='?' (DbType = DateTime)], CommandType='Text', CommandTimeout='30']**
** INSERT INTO public.flight_plan (approval_status_id, drone_id, drone_track_id, end_date_time, geo_data, region_id, start_date_time, status_date, status_id, submission_date)**
** VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9)**
** RETURNING id;**
Npgsql.PostgresException (0x80004005): 42804: column "geo_data" is of type xml but expression is of type text
** at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<g__ReadMessageLong|0>d.MoveNext()**
--- End of stack trace from previous location where exception was thrown ---
** at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<g__ReadMessageLong|0>d.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 1032**
--- End of stack trace from previous location where exception was thrown ---
** at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 444**
** at Npgsql.NpgsqlDataReader.NextResult() in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 332**
** at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 1218**
** at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 1130**
** at System.Data.Common.DbCommand.ExecuteReader()**
** at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)**

Can you post the data your are trying to submit? Is it something like this?
https://developers.google.com/public-data/docs/canonical/geo_xml

We've just fixed a problem related to XML submit and it will be part of our next release. You will need however to reinfer your data-source to update the meta data.



Thank you for the reply, i will try it out.