2 added 173 characters in body
source | link

The reason for this is because '5 days' at that point is essentially '5 days'::unknown. From that pointthere the question is whether the right option is '5 days'::int or '5 days'::interval.

  • '5 days'::int or
  • '5 days'::interval

Sure, '5 days'::int isn't valid, but unknown ->int> int is required so you can say SELECT '5' + 5;. PostgreSQL doesn't know that "5 days" will throw an exception until after it tries and because both are typed the same it just gives up rather than guessing randomly.

There is no good work around to this.

You can see it documented under Functions: Type Conversion

The reason for this is because '5 days' at that point is essentially '5 days'::unknown. From that point the question is whether the right option is '5 days'::int or '5 days'::interval.

Sure, '5 days'::int isn't valid, but unknown->int is required so you can say SELECT '5' + 5;

There is no good work around to this.

You can see it documented under Functions: Type Conversion

The reason for this is because '5 days' at that point is essentially '5 days'::unknown. From there the question is whether the right option is

  • '5 days'::int or
  • '5 days'::interval

Sure, '5 days'::int isn't valid, but unknown -> int is required so you can say SELECT '5' + 5;. PostgreSQL doesn't know that "5 days" will throw an exception until after it tries and because both are typed the same it just gives up rather than guessing randomly.

There is no good work around to this.

You can see it documented under Functions: Type Conversion

1
source | link

The reason for this is because '5 days' at that point is essentially '5 days'::unknown. From that point the question is whether the right option is '5 days'::int or '5 days'::interval.

Sure, '5 days'::int isn't valid, but unknown->int is required so you can say SELECT '5' + 5;

There is no good work around to this.

You can see it documented under Functions: Type Conversion