Re: Is it possible to use keywords (date units) in a function definition?

From: Alistair Johnson <aewj(at)mit(dot)edu>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is it possible to use keywords (date units) in a function definition?
Date: 2020-06-08 23:22:36
Message-ID: CAKHmqNDF=yKXQ7ML3L9sMC0xCtJDYtdDQcS68GSV9NtqW9nyFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> I think you need to be more specific as to what "this" means.
>
> Looking again after Andrian's comment are you trying to write, in the
> script file:
>
> datetime_diff('start time as string'::timestamp, 'end time as
> string'::timestamp, HOUR)
>
> and get PostgreSQL to recognize the value HOUR as a custom type
> value without single quotes surrounding it
>
> If that is the question the answer is no. The only type literals that can
> be written without single quotes are numbers.
>
> The parsing of SQL can handle some standard mandated non-quoted constants
> but they are basically keywords, not values.
>
> David J.
>

Thanks David - that was exactly my question - and it's nice to have a clear
answer even if it wrinkles my plans a bit!

-Alistair

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter 2020-06-09 00:02:53 12.2: Why do my Redo Logs disappear??
Previous Message David G. Johnston 2020-06-08 23:09:53 Re: Is it possible to use keywords (date units) in a function definition?