Skip to content

Writing values of 'Pgvector.Vector' is not supported for parameters having no NpgsqlDbType or DataTypeName. Try setting one of these values to the expected database type #51

@Issung

Description

@Issung

Sorry I never do this but after 2 days I can't crack this nut and have reached my limit 😂

I've been getting this error when trying to save a type with a Vector column in it...

Writing values of 'Pgvector.Vector' is not supported for parameters having no NpgsqlDbType or DataTypeName. Try setting one of these values to the expected database type..

   at Npgsql.Internal.AdoSerializerHelpers.<GetTypeInfoForWriting>g__ThrowWritingNotSupported|1_0(Type type, PgSerializerOptions options, Nullable`1 pgTypeId, Nullable`1 npgsqlDbType, Exception inner)
   at Npgsql.Internal.AdoSerializerHelpers.GetTypeInfoForWriting(Type type, Nullable`1 pgTypeId, PgSerializerOptions options, Nullable`1 npgsqlDbType)
   at Npgsql.NpgsqlParameter.ResolveTypeInfo(PgSerializerOptions options)
   at Npgsql.NpgsqlParameterCollection.ProcessParameters(PgSerializerOptions options, Boolean validateValues, CommandType commandType)
   at Npgsql.NpgsqlCommand.<ExecuteReader>d__120.MoveNext()
   at Npgsql.NpgsqlCommand.<ExecuteReader>d__120.MoveNext()
   at Npgsql.NpgsqlCommand.<ExecuteDbDataReaderAsync>d__113.MoveNext()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.<ExecuteReaderAsync>d__18.MoveNext()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.<ExecuteReaderAsync>d__18.MoveNext()
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.<ExecuteAsync>d__50.MoveNext()

I've tried everything I can, today I created minimal projects following your guides, then another using IdentityDbContext thinking that may be the issue, nothing seems to fix it. I downloaded the Npgsql source code and mounted it to see where this exception was thrown and debug from there but couldn't figure it out much further.

My repo is relatively small it's just some prototyping with Razor Pages and your stuff. If you clone the commit linked below, startup the pg17 docker container, and try to run the DndTest project, it will try to do an insert of the type and reproduce the error immediately. The other projects are attempts at minimal reproductions but they don't reproduce 😭

Or if you just take a look at the source code or have some recommendations of things to try before doing that it would all be greatly appreciated 🙏

https://github.com/Issung/SemanticDnd/commit/83d430bfc82567575f6262a1f06abbedc23d1811

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions