Closed fabrice-toussaint closed 1 year ago
Hi,
pg-mem only supports a few operators. You can easily declare others like this:
import { Interval } from 'pgsql-ast-parser';
db.public.registerOperator({
operator: '-',
left: DataType.timestamp,
right: DataType.timestamp,
returns: DataType.interval,
implementation: (a, b): Interval => {
// implement here the difference of two dates, returned as `Interval` type
// (which is the internal type in which intervals are stored)
},
});
ps: this is a general-enough operator... it could be integrated in the pg-mem codebase.
If you do implement it, dont hesitate to copy/paste it here, or create a pull request binary-operators.ts ^^
Describe the bug
Hi all,
I am using pg-mem for testing purposes and I am running into the following problem. When I want to subtract timestamps it throws the following error:
QueryFailedError: operator does not exist: timestamp without time zone - timestamp without time zone.
Is this normal behaviour, if so, how do I work around it? Thanks in advance!
To Reproduce
pg-mem version
I am using version 2.6.12.