question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect parsing of timestamp's milliseconds with a leading zero

See original GitHub issue

Describe the bug

Given a column of type timestamp, leading zero in milliseconds is ignored. Example: inserted value “2021-03-03T08:31:15.077Z” will be read as “2021-03-03 08:31:15.770000”

To Reproduce

Given following table:

SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'solutions';

# id | character varying
# created_at | timestamp without time zone

And following test script

const AWS = require('aws-sdk');

const resourceArn = '';
const secretArn = '';
const database = '';
const endpoint = '';

const rdsDataService = new AWS.RDSDataService({ endpoint });

const executeSql = (sql) => rdsDataService.executeStatement({ resourceArn, secretArn, database, sql }).promise();

const test = async (sql) => {
  await executeSql(`INSERT INTO solutions (id, created_at) VALUES ('1', '2021-03-03T08:31:15.077Z')`);
  const { records } = await executeSql(`SELECT * FROM solutions WHERE id = '1'`);
  console.log(records);
}

The output would be following:

[
  [
    { stringValue: '1' },
    { stringValue: '2021-03-03 08:31:15.770000' },
  ]
]

Expected behavior

Is should behave equally to AWS Aurora Data API and return:

[
  [
    { stringValue: '1' },
    { stringValue: '2021-03-03 08:31:15.077' },
  ]
]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
akarmescommented, Mar 11, 2021

Thank you @koxudaxi! I can confirm the issue is resolved.

1reaction
akarmescommented, Mar 11, 2021

I was just writing next bug report 😅 Thank you again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing milliseconds, when parsing Java 8 date-time, if they ...
Where the trailing zeros are cut off. This seems to be a issue with the deeper dateTimeFormatter. The issue is if a Json...
Read more >
SimpleDateFormat is not parsing the milliseconds correctly
When I do an "ORDER BY TIMESTAMP ASC", timeStamp2 is considered as the greater timestamp(which is correct). Requirement: I need to get the ......
Read more >
Time Stamp incorrectly displayed in XLS file when ...
Time Stamp incorrectly displayed in XLS file when Milliseconds is used. Hi all, Got a bit of issue when trying to write the...
Read more >
luxon 3.1.1 | Documentation
It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. A DateTime comprises of: A timestamp. Each ...
Read more >
String + Format
List of all available parsing tokens ; SS, 00-99, Tens of milliseconds, 2-digits ; SSS, 000-999, Milliseconds, 3-digits ; Z · -05:00, Offset...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found