Example #1
0
        public void StatementOID()
        {
            using var conn = OpenConnection();

            TestUtil.MaximumPgVersionExclusive(conn, "12.0",
                                               "Support for 'CREATE TABLE ... WITH OIDS' has been removed in 12.0. See https://www.postgresql.org/docs/12/release-12.html#id-1.11.6.5.4");
            conn.ExecuteNonQuery("CREATE TEMP TABLE data (name TEXT) WITH OIDS");

            using var cmd = new NpgsqlCommand(
                      "INSERT INTO data (name) VALUES (@p1);" +
                      "UPDATE data SET name='b' WHERE name=@p2",
                      conn);

            cmd.Parameters.AddWithValue("p1", "foo");
            cmd.Parameters.AddWithValue("p2", "bar");
            cmd.ExecuteNonQuery();

            Assert.That(cmd.Statements[0].OID, Is.Not.EqualTo(0));
            Assert.That(cmd.Statements[1].OID, Is.EqualTo(0));
        }