Skip to content

Strict field type checks in .as<T>() #7

@AntonProtasovHub

Description

@AntonProtasovHub

The current implementation of the library has field type checks via the size of the binary representation of the expected type. However, there may be situations when this check is successful, but the data type specified via the template parameter postgrespp::field::as<T> does not match the type in the database. For example, the database data type is double precision (8 bytes), and the as method template specifies the type std::uint64_t (8 bytes).

I have an idea how to add additional checks on the actual field type. For this, you can use the OID returned by the PQftype method. The decoder template instance will contain means for checking whether the actual OID matches the expected type.

Do you agree to accept such changes if I prepare a pull request? We can discuss specific interfaces if you agree to such a change.

P.S. Sorry for google translate, English is not my native language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions