Re: Is it possible to use keywords (date units) in a function definition? - Mailing list pgsql-general

From Alistair Johnson
Subject Re: Is it possible to use keywords (date units) in a function definition?
Date
Msg-id CAKHmqNDF=yKXQ7ML3L9sMC0xCtJDYtdDQcS68GSV9NtqW9nyFA@mail.gmail.com
Whole thread Raw
In response to Re: Is it possible to use keywords (date units) in a function definition?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Is it possible to use keywords (date units) in a function definition?
Next
From: Peter
Date:
Subject: 12.2: Why do my Redo Logs disappear??