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 wit

[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 updat

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

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 functio

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 cha

[SQL] Delete denied?

2003-08-22 Thread Josh Berkus
Stephan, Tom: Hey, I have a function which can involve some records being deleted at the end. The user calling the function has permission to delete records (and I've tested this), but when I run the function I get "permission denied". Any clue? I remember in 7.1.x that you couldn't delete r

[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 curr

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"

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? > > Elapse

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] 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

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 ca

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

2003-08-22 Thread Tom Lane
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 ... as seen by the client, of course. > The figures reported >

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 sign

[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] 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 broad

[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 ext