Skip to content

PDO::FETCH_KEY_PAIR on a result with a number of columns other than two throws a different exception message/shape than php. #301

Closed

Description

@blacktrs

Summary

PDO::FETCH_KEY_PAIR on a result with a number of columns other than two throws a different exception message/shape than php.

Repro

<?php
$db = new PDO('sqlite::memory:', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$st = $db->query('select 1 as a, 2 as b, 3 as c');
try { $st->fetchAll(PDO::FETCH_KEY_PAIR); } catch (PDOException $e) { echo $e->getMessage(), ' ', json_encode($e->errorInfo), "\n"; }

Expected (php)

SQLSTATE[HY000]: General error: PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain exactly 2 columns. ["HY000",0]

Actual (manticore e1d451af, Darwin arm64)

PDO::FETCH_KEY_PAIR needs a result set with exactly 2 columns null

Tracking

Known-bug repro: tests/aot/repro/wrong/pdo_fetch_key_pair_wrong_column_count_message.php — bash tests/aot/xfail.sh -k pdo_fetch_key_pair_wrong_column_count_message reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions