Skip to content

Change in Clr Byte Parameter mapping #5521

@DvdKhl

Description

@DvdKhl

The issue

Not sure if this is a bug or intentional.

The parameter mapping of a clr byte has changed from smallint to char.
I could narrow down the change between 8.0.0-preview.4 and 8.0.0-rc.2 but I haven't found the specific commit or issue.

If this was intentional it would be nice to know why so I can make changes accordingly.

Steps to reproduce

Create a Console NET8 Project and add Npgsql (8.0.0-preview.4)
Replace Program.cs with the following code

using Npgsql;
using System.Data.Common;

var conn = new NpgsqlConnection("User ID=someUSer;Password=somePass;Host=localhost;Port=5432;Database=postgres;Pooling=true");
conn.Open();

var cmd = conn.CreateCommand();
var p = cmd.CreateParameter();
p.Value = (byte)1;

cmd.CommandText = "select 1";
cmd.Parameters.Add(p);

var asdg = cmd.ExecuteScalar();

Console.WriteLine(((NpgsqlParameter)p).DataTypeName);

Console output is "smallint"
Upgrade to Npgsql 8.0.0-rc.2
Run the program again.
The console output is now "char"

Further technical details

Npgsql version: 8.0.1
PostgreSQL version: 15
Operating system: Windows 10

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions