Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

parameter parsing fails (regression) #296

Copy link
Copy link
@kobruleht

Description

@kobruleht
Issue body actions

Newer npgsql versions does not parse :p parameters properly.
In 2.2.0-beta1 code below produces error

syntax error at or near ":"

shown in comment. npgsql sends :p6 to server without parsing it.

        using (var connection = new NpgsqlConnection(ConnectionString()))
        {
            connection.Open();
            DbCommand command = (DbCommand)connection.CreateCommand();
           command.CommandText = @"
 SELECT 1
 WHERE ''= 'type(''m.response'')#''O''%' AND :p6
            ";

           for (int i = 0; i < 7; i++)
           {
               IDbDataParameter param = command.CreateParameter();
               param.ParameterName = "p" + i.ToString();
               var value = DBNull.Value;
               command.Parameters.Add(param);
           }
           // syntax error at or near ":"
            command.ExecuteReader();
         }

    static string ConnectionString()
    {
        NpgsqlConnectionStringBuilder csb = new NpgsqlConnectionStringBuilder()
        {
            SearchPath = "public",
            Host = "localhost",
            Database = "postgres",
            UserName = "postgres",
            Password = "secret"
        };
        return csb.ConnectionString;
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.