Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么Npgsql反转tsquery数据?_C#_Postgresql_Npgsql - Fatal编程技术网

C# 为什么Npgsql反转tsquery数据?

C# 为什么Npgsql反转tsquery数据?,c#,postgresql,npgsql,C#,Postgresql,Npgsql,我正在尝试使用C#上的Npgsql从PostgreSQL数据库读取tsquery数据 我有一个表,其中一列为tsquery类型,其中的数据如下所示: a ----------------- 'a' & 'b' 'a' <-> 'b' 'a' & 'b' | 'c' 由于SELECT'ab'::tsquery='ba'::tsquery在Postgres中返回false,我认为这可能会导致问题 我试图在文档中找到任何相关信息,但没有成功。为什么N

我正在尝试使用C#上的Npgsql从PostgreSQL数据库读取
tsquery
数据

我有一个表,其中一列为
tsquery
类型,其中的数据如下所示:

        a
-----------------
 'a' & 'b'
 'a' <-> 'b'
 'a' & 'b' | 'c'
由于
SELECT'ab'::tsquery='ba'::tsquery
在Postgres中返回false,我认为这可能会导致问题

我试图在文档中找到任何相关信息,但没有成功。为什么Npgsql要颠倒顺序?我是否缺少参数或函数

我用来获得这些结果的代码:

var connString = "Host=localhost; Username=postgres; Database=postgres; Port=9700;";
using var conn = new NpgsqlConnection(connString);
conn.Open();

using var cmd = new NpgsqlCommand("SELECT * FROM tbl", conn);
using var reader = cmd.ExecuteReader();
while (reader.Read())
{
    Console.WriteLine(reader.GetValue(0));
}

这被交叉发布在github上,作为跟踪进度的依据

var connString = "Host=localhost; Username=postgres; Database=postgres; Port=9700;";
using var conn = new NpgsqlConnection(connString);
conn.Open();

using var cmd = new NpgsqlCommand("SELECT * FROM tbl", conn);
using var reader = cmd.ExecuteReader();
while (reader.Read())
{
    Console.WriteLine(reader.GetValue(0));
}