Re: [SQL] avg(interval)

2006-06-26 Thread Joe
Erik Jones wrote: Well, the query is working ok numerically, but should the answer really be reported as 4 days and 33 hours? Well, the original poster didn't provide the table schema or PG version, but on PG 8.0.3 both with intervals or with differences between timestamps, the query appears

Re: [SQL] avg(interval)

2006-06-26 Thread Erik Jones
Well, the query is working ok numerically, but should the answer really be reported as 4 days and 33 hours? Erik Aaron Bono wrote: Right, the 23 is just less than 1 day, not 23 days. The good news: your query is working! -Aaron On 6/26/06, *Joe* < [EMAIL PROTECTED]

Re: [SQL] permissions from system catalogs

2006-06-26 Thread Michael Fuhr
On Mon, Jun 26, 2006 at 05:30:12PM -0600, Kyle Bateman wrote: > Can anyone point me where to look in the system catalogs (or information > schema) to determine in advance whether a given user (or the current > user) will have select permission to a given table or view? An easy way is to use the

Re: [SQL] permissions from system catalogs

2006-06-26 Thread Tom Lane
Kyle Bateman <[EMAIL PROTECTED]> writes: > Can anyone point me where to look in the system catalogs (or information > schema) to determine in advance whether a given user (or the current > user) will have select permission to a given table or view? Try has_table_privilege() http://www.postgresq

Re: [SQL] avg(interval)

2006-06-26 Thread Aaron Bono
Right, the 23 is just less than 1 day, not 23 days.The good news: your query is working!-AaronOn 6/26/06, Joe < [EMAIL PROTECTED]> wrote:Tom Lane wrote:> "Jeremiah Elliott" < [EMAIL PROTECTED]> writes:>> however if i don't average them here is what i get:>> "7 days 22:24:50.62311";"*2420">> "9 days

[SQL] permissions from system catalogs

2006-06-26 Thread Kyle Bateman
Can anyone point me where to look in the system catalogs (or information schema) to determine in advance whether a given user (or the current user) will have select permission to a given table or view? Kyle ---(end of broadcast)--- TIP 6: explai

Re: [SQL] Problem w/ Join... Using (...) Syntax

2006-06-26 Thread Alvaro Herrera
[EMAIL PROTECTED] wrote: > how does one apply the JOIN... USING (...) syntax when > the primary key and foreign key have different names? > > JOIN t_employee USING (employee_id) > > works perfect when the primary and foreign key are > both named employee_id. t_inspection JOIN t_employee ON (t_em

[SQL] Problem w/ Join... Using (...) Syntax

2006-06-26 Thread operationsengineer1
how does one apply the JOIN... USING (...) syntax when the primary key and foreign key have different names? JOIN t_employee USING (employee_id) works perfect when the primary and foreign key are both named employee_id. however, it one is named inspector_id and the other employee_id, it doesn't

Re: [SQL] avg(interval)

2006-06-26 Thread Joe
Tom Lane wrote: "Jeremiah Elliott" <[EMAIL PROTECTED]> writes: however if i don't average them here is what i get: "7 days 22:24:50.62311";"*2420" "9 days 22:21:02.683393";"*2420" "23:21:35.458459";"*2420" "4 days 22:47:41.749756";"*2420" "3 days 06:05:59.456947";"*2420" which should average

Re: [SQL] avg(interval)

2006-06-26 Thread Tom Lane
"Jeremiah Elliott" <[EMAIL PROTECTED]> writes: > however if i don't average them here is what i get: > "7 days 22:24:50.62311";"*2420" > "9 days 22:21:02.683393";"*2420" > "23:21:35.458459";"*2420" > "4 days 22:47:41.749756";"*2420" > "3 days 06:05:59.456947";"*2420" > which should average to just

[SQL] avg(interval)

2006-06-26 Thread Jeremiah Elliott
I am getting some really strange query output. I am trying to average an interval. The problem is that the interval average is sometimes returning more than 24 hours for the average. query: select avg(scan_date - backflush_date) as time_diff, substring(pt_article, 1, 5) as clan, sum(qty) as unit

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Andrew Sullivan
On Mon, Jun 26, 2006 at 10:38:06AM -0500, Scott Marlowe wrote: > I bet it would be possible to hack pgpool to do this. Just have it > shoot all the queries that come in to it at the normal database, AND at > a text file or something like that. Now you're back to the same problem: it doesn't tell

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Scott Marlowe
On Mon, 2006-06-26 at 08:59, Forums @ Existanze wrote: > Hello again, > > The problem is not tracking WHAT changed, this can be done, as we have > discussed in this thread, the problem is how to replicate the necessary > commands that will alter a mirror database to reflect what has been changed,

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Andrew Sullivan
On Mon, Jun 26, 2006 at 04:59:26PM +0300, Forums @ Existanze wrote: > Hello again, > > The problem is not tracking WHAT changed, this can be done, as we have > discussed in this thread, the problem is how to replicate the necessary > commands that will alter a mirror database to reflect what has b

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Richard Broersma Jr
> The problem is not tracking WHAT changed, this can be done, as we have > discussed in this thread, the problem is how to replicate the necessary > commands that will alter a mirror database to reflect what has been changed, > sequencially and in the order that it has occurred. If your finial goa

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Forums @ Existanze
Hello again, The problem is not tracking WHAT changed, this can be done, as we have discussed in this thread, the problem is how to replicate the necessary commands that will alter a mirror database to reflect what has been changed, sequencially and in the order that it has occurred. I you can fi

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Andrew Sullivan
On Fri, Jun 23, 2006 at 10:29:33PM -0500, Aaron Bono wrote: > > What I really cannot find is a way to _dynamically_ in the trigger ask what > COLUMNS are in OLD and NEW. If we had: All of the columns, of course. When the tuple is UPDATEd, even if you did not mention some columns in your UPDATE,