On 8/7/05, Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > Brendan Jurd <direvus@xxxxxxxxx> writes: > > Are there any good reasons why the output of timeofday() needs to > > include the three letter day-of-week? > > If we are going to change it, I'd be inclined to make it output the > canonical ISO format (YYYY-MM-DD HH:MM:SS.SSSS-TZ). Or perhaps the > format should be the same as whatever the current DateStyle setting > would emit. > > regards, tom lane > Going to ISO format would be a big improvement. Does anybody know why this function returns text? The documentation cites "historical reasons". Are any of those historical reasons still relevant? I would suggest that in the vast majority of cases, the desired type from timeofday() is timestamp. Wouldn't it make more sense to have it return timestamp, and then use to_char() for those cases where we want a textual representation of the time? Currently the function gets the time as a "pg_time_t", then converts it into a string with pg_strftime(). Then, in order to make the value useful we run that string through a datetime parser. I realise it's not a major performance hit, but it's just not elegant to run all these superfluous conversions. In the interests of backwards compatibility, how about I just write a new function that does the same thing as timeofday(), but returns timestamp? Or perhaps I could add an optional precision parameter to timenow(), so you could call timenow(6) and achieve the same thing. Objections? -- BJ ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster