Обсуждение: novice question about current_time()

Поиск
Список
Период
Сортировка

novice question about current_time()

От
"Johnson, Shaunn"
Дата:
Running PostgreSQL 7.2.1 on RedHat Linux 7.2.  
 
I have a query where I'd like to know how much time 
has passed from me launching and ending the query.
 
So, in the script, I have:
 
[snip]
select 'begin', current_time();
 
select * from t_test;
 
select 'end', current_time();
 
[/snip] 
 
What seems to be happening is that when I launch the
script, it hangs ... nothing seems to be happening.  I
run top or do a ps auwx| grep 'name-of-script', it shows up idle.
If I comment out the line with current_time (); things seem
to work. I even tried to run it with explain, but, again, it
just hangs ...
 
Why is that?
 
Thanks!
 
-X

Re: novice question about current_time()

От
Christoph Dalitz
Дата:
> Date: Mon, 4 Nov 2002 10:46:00 -0500
> From: "Johnson, Shaunn" <SJohnson6@bcbsm.com>
>
> I have a query where I'd like to know how much time
> has passed from me launching and ending the query.
>
> So, in the script, I have:
>
> [snip]
> select 'begin', current_time();
> [/snip]
>
> What seems to be happening is that when I launch the
> script, it hangs ... nothing seems to be happening.  I
>
This is a consequence of a brain dead ANSI SQL standard which tries to make
SQL as similiar to spoken English as possible (eg. CAST(bla AS int) etc.).

ANSI-SQL requires the ommittance of the parenthesis. Thus the
following should work:

select 'begin', current_time;

Christoph Dalitz