[SQL] date calculation

2003-08-22 Thread MichaelHoeller
Hi there, I have a problem calculating a date. A field carries the date as passed seconds since Jan 1st 1970. How can I get the date as dd.mm. out of this?? Thanks a lot Michael ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] SELECT IN Still Broken in 7.4b

2003-08-22 Thread Bertrand Petit
On Wed, Aug 20, 2003 at 04:32:19PM -0400, Tom Lane wrote: against actual elapsed time (cf psql's \timing option) would tell. What is measured by the \timing option? The figures reported are slightly larger than those loged when the log_duration parameter is true. = select count(*) from

Re: [SQL] date calculation

2003-08-22 Thread Tomasz Myrta
Hi there, I have a problem calculating a date. A field carries the date as passed seconds since Jan 1st 1970. How can I get the date as dd.mm. out of this?? cast('1970-1-1' as timestamp)+cast(your_ticks || ' seconds' as interval) Does anyone know better way to cast it? Regards, Tomasz Myrta

[SQL] Joined deletes but one table being a subquery.

2003-08-22 Thread Rajesh Kumar Mallah
Hi Folks, DELETE from eyp_listing where userid=t_a.userid and category_id=t_a.category_id; such queries work perfectly. but if t_a is a subquery how to accomplish the delete. Regds Mallah. ---(end of broadcast)--- TIP 5: Have you checked our

Re: [SQL] Joined deletes but one table being a subquery.

2003-08-22 Thread Tomasz Myrta
Hi Folks, DELETE from eyp_listing where userid=t_a.userid and category_id=t_a.category_id; such queries work perfectly. but if t_a is a subquery how to accomplish the delete. What kind of subquery it is? Exist/Not exist doesn't work? Regards, Tomasz Myrta ---(end of

[SQL] Bug on parameter bigint in PL/PGSQL

2003-08-22 Thread Michele Bendazzoli
I think i found a bug in PL/PGSQL: when i use a parameter bigint (int8) and call the function from psql an error message which says that the functioname(bigint) doesn't exist is displayed. If i turn the int8 to int4 all works fine ... Now i use two int4 instead of one int8: is advisable? ciao,

Re: [SQL] SELECT IN Still Broken in 7.4b

2003-08-22 Thread Rod Taylor
What is measured by the \timing option? The figures reported are slightly larger than those loged when the log_duration parameter is true. The time of the psql client. It will include round trip activity including network overhead. signature.asc Description: This is a digitally signed

Re: [SQL] date calculation

2003-08-22 Thread Tom Lane
Tomasz Myrta [EMAIL PROTECTED] writes: cast('1970-1-1' as timestamp)+cast(your_ticks || ' seconds' as interval) Does anyone know better way to cast it? The above will probably give the wrong answer (off by your timezone offset). The reference point should be zero hour GMT, but the first cast

Re: [SQL] Bug on parameter bigint in PL/PGSQL

2003-08-22 Thread Stephan Szabo
On Fri, 22 Aug 2003, Michele Bendazzoli wrote: I think i found a bug in PL/PGSQL: when i use a parameter bigint (int8) and call the function from psql an error message which says that the functioname(bigint) doesn't exist is displayed. If i turn the int8 to int4 all works fine ... I can't

Re: [SQL] Bug on parameter bigint in PL/PGSQL

2003-08-22 Thread Richard Huxton
On Friday 22 August 2003 12:59, Michele Bendazzoli wrote: I think i found a bug in PL/PGSQL: when i use a parameter bigint (int8) and call the function from psql an error message which says that the functioname(bigint) doesn't exist is displayed. If i turn the int8 to int4 all works fine ...

Re: [SQL] SELECT IN Still Broken in 7.4b

2003-08-22 Thread Bertrand Petit
On Fri, Aug 22, 2003 at 08:50:15AM -0400, Tom Lane wrote: Bertrand Petit [EMAIL PROTECTED] writes: On Wed, Aug 20, 2003 at 04:32:19PM -0400, Tom Lane wrote: against actual elapsed time (cf psql's \timing option) would tell. What is measured by the \timing option? Elapsed time ...

Re: [SQL] Bug on parameter bigint in PL/PGSQL

2003-08-22 Thread Michele Bendazzoli
On Fri, 2003-08-22 at 15:05, Richard Huxton wrote: On Friday 22 August 2003 12:59, Michele Bendazzoli wrote: I think i found a bug in PL/PGSQL: when i use a parameter bigint (int8) and call the function from psql an error message which says that the functioname(bigint) doesn't exist is

[SQL] composite type in a table

2003-08-22 Thread floyds
is there any way to use a composite type in a table? here's an example: say i want to create a type to hold currency: create type currency_type as ( base_objid int, base_amt decimal, conversion_rate decimal, converted_objid int ); i'd like to be able to define a column in a table of type

Re: [SQL] Delete denied?

2003-08-22 Thread Josh Berkus
Guys: Contributing could be that the table holding the deleted records is a child table with an ON CASCADE DELETE of one of the tables being updated elsewhere in the function. And the function works if called by the owner of the table (and the function). Further update: I tried changing

Re: [SQL] Delete denied?

2003-08-22 Thread Tom Lane
Josh Berkus [EMAIL PROTECTED] writes: Contributing could be that the table holding the deleted records is a child table with an ON CASCADE DELETE of one of the tables being updated elsewhere in the function. And the function works if called by the owner of the table (and the function). I

Re: [SQL] Delete denied?

2003-08-22 Thread Stephan Szabo
On Fri, 22 Aug 2003, Josh Berkus wrote: Guys: Contributing could be that the table holding the deleted records is a child table with an ON CASCADE DELETE of one of the tables being updated elsewhere in the function. And the function works if called by the owner of the table (and the

[SQL] Auto-update a field when record is changed

2003-08-22 Thread Stuart
Folks, I was wandering if there was a feasible way to automatically update a field in a table, say 'revision_date' in a record whenever any other field in the record is changed. My attempts to use a trigger caused repeating loops and bombed with error. I would like to be able to

Re: [SQL] Auto-update a field when record is changed

2003-08-22 Thread Stephan Szabo
On Fri, 22 Aug 2003, Stuart wrote: Folks, I was wandering if there was a feasible way to automatically update a field in a table, say 'revision_date' in a record whenever any other field in the record is changed. My attempts to use a trigger caused repeating loops and bombed with