Hallo!
Ich wollte das letzte "SELECT" Beispiel von
diesem Beitrag ausprobieren, aber es funktioniert nicht:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my $table = 'timestampt';
$dbh->do( "CREATE TABLE IF NOT EXISTS $table ( Id INT, epoch_micro BIGINT, epoch_milli BIGINT, epoch_s BIGINT )" );
my $sth = $dbh->prepare( "INSERT INTO $table ( Id, epoch_micro, epoch_milli, epoch_s ) VALUES ( ?, ?, ?, ? )" );
my $values = [
[ 1, 1387528449510009, 1387528449510, 1387528449 ],
[ 2, 1387528449518239, 1387528449518, 1387528449 ],
[ 3, 1387529362307977, 1387529362307, 1387529362 ],
];
for my $row ( @$values ) {
$sth->execute( @$row );
}
$sth = $dbh->prepare( "SELECT TO_TIMESTAMP( extract( epoch epoch_milli ))::date FROM $table" );
$sth->execute();
$sth->dump_results;
DBD::Pg::st execute failed: FEHLER: Syntaxfehler bei "epoch_milli"
ZEILE 1: SELECT TO_TIMESTAMP( extract( epoch epoch_milli ))::date FRO...
Kann mir jemand sagen, was hier nicht stimmt?