-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
[BUG]: update timestamp field (using AWS Data API) #1164
Comments
I created a PR that I think fixes this. I'd love some feedback from anyone on how this could be better... #1316 |
@kyen99 FYI I also found a workaround, this seems to work for me. With a table defined as:
Then you can set that field with:
Note the |
This is most likely closed by #1659 |
Thanks @jakeleventhal, I see a fix went out in 0.29.2. This issue can be closed. |
Was fixed in 0.29.2, so closing this one |
this was working for me for a while, but now this same issue appears to exist with between query filters when the value is a date object and when inserting again: return await db.query.table.findMany({
where: (table, { eq, between }) =>
and(
eq(table.fkId, fkId),
between(table.time, startDate, endDate),
),
}); export const upsert = async (itemToUpsert: NewItem[]) => {
const upserted = await db
.insert(table)
.values(itemToUpsert)
.returning();
return upserted;
}; i'm using a pg table with the following column: |
The problem appears to be in mapToDriverValue = (value) => {
return this.withTimezone ? value.toUTCString() : value.toISOString();
}; the |
FYI @AndriiSherman |
Should be fixed in I plan to release it in version |
@AndriiSherman I am now able to insert and select timestamptz with AWS Data API (v1), BUT i believe the conversion from DB date/time to typescript Date is incorrect. e.g. SELECT start_time, EXTRACT(TIMEZONE FROM start_time) as timezone FROM table; yields (notice timezone is 0, which represents UTC or 0 offset):
but in typescript it is serialized in my local timezone: 'Wed Mar 20 2024 13:00:00 GMT-0500 (Central Daylight Time)' or '2024-03-20T18:00:00.000Z' |
Seems like you should be able to update your integrations tests to insert a specific time and then upon retrieval verify the same time that was inserted was retrieved (via |
do you have |
Timestamp with time zone |
@AndriiSherman just a heads up that i am still getting the issue on 0.30.1 with the timestamps being in different timezones. I am using timestamp with timezone in mode date. In the DB, it is in UTC, but I get it back in typescript in my local timezone with the same time. |
@AndriiSherman see my last post in the general discord channel. I think I have a fix, but I'm not 100% sure why. Looks like some of my timestamps with timezones are coming back to drizzle without the '+' that has the timezone offset? |
@danclaroni FYI, |
I can't figure out the fix from this thread. I'm on drizzle-orm@0.30.10, Data API Aurora Serverless V1 postgres 13.12. |
@patrick-geyer-21 here is my patch. Not sure it will work perfectly for you, but you can try it:
|
What version of
drizzle-orm
are you using?0.27.2
What version of
drizzle-kit
are you using?0.19.5
Describe the Bug
I'm trying drizzle-orm (with sst) and aurora pg thru aws data api, when trying to insert (or update) a Date value in a column (timestamp with timezone), I'm getting this error.
I wonder if the problem is the way Date is being serialized (looks like something is using a
toString
instead of using ISO date string?)this shows the response coming from aws-data-api
Expected behavior
row is updated with the provided
Date
object valueEnvironment & setup
AWS aurora postgres, AWS Data API
The text was updated successfully, but these errors were encountered: