Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP/PDO reads corrupt values #1059

Closed
bluestreak01 opened this issue May 24, 2021 · 1 comment · Fixed by #1194
Closed

PHP/PDO reads corrupt values #1059

bluestreak01 opened this issue May 24, 2021 · 1 comment · Fixed by #1194
Labels
Bug Incorrect or unexpected behavior Postgres Wire Issues or changes relating to Postres wire protocol

Comments

@bluestreak01
Copy link
Member

// QDB
$dbName = 'qdb';
$hostname = '127.0.0.1';
$password = 'quest';
$port = 8812;
$username = 'admin';

$pdo = new PDO("pgsql:host=$hostname;dbname=$dbName;port=$port", $username, $password);
echo '<pre>';
$stmt = $pdo->prepare("SELECT * FROM test_table");
try {
    $stmt->execute(array());
    while ($row = $stmt->fetch()) {
        print_r($row);
    }
} catch(PDOException $e) {
    echo $e;
}

Produces corrupt output:

Array
(
    [personnel_id] => 0 // this is bugged, it should be returning a value of 1...
    [0] => 0
    [ts] => IXO�` // timestamp is bugged
    [1] => IXO�` 
    [date] => ������X // date is bugged
    [2] => ������X 
    [name] => test_string // this string works fine...
    [3] => test_string
    [value] => 0
    [4] => 0
)

https://stackoverflow.com/questions/67678674/questdb-select-returning-special-chars-but-postgres-does-not

@bluestreak01 bluestreak01 added Bug Incorrect or unexpected behavior Postgres Wire Issues or changes relating to Postres wire protocol labels May 24, 2021
@bluestreak01 bluestreak01 added this to To do in PostgreSQL wire protocol via automation Jun 21, 2021
@andyfleming
Copy link

Copying over some relevant info from the SO question:

QuestDB 6.0.2
PHP 8.0.2

If I change from SELECT * to SELECT <single_column> like SELECT date FROM test_table, it works fine... But if I add more columns to the query, then the character encoding bugs return.

This bug also happens with the pre-installed telemetry table, so I don't think it's related to the way I'm creating tables.

@bluestreak01 bluestreak01 moved this from To do to To be reproduced in PostgreSQL wire protocol Jul 12, 2021
@bluestreak01 bluestreak01 moved this from To be reproduced to In progress in PostgreSQL wire protocol Jul 12, 2021
eugenels added a commit that referenced this issue Jul 13, 2021
PostgreSQL wire protocol automation moved this from In progress to Done Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect or unexpected behavior Postgres Wire Issues or changes relating to Postres wire protocol
Development

Successfully merging a pull request may close this issue.

2 participants