[GENERAL] Weird query sort

2008-12-27 Thread Jeffrey Melloy
I have a table, queries, with a column value. There is a trigger on this table that inserts into query_history for each update to value. I'm trying to graph the query_history table, so I was using a custom aggregate to turn it into an array: CREATE AGGREGATE array_accum (anyelement) ( sfunc = arr

Re: [GENERAL] SQL - finding next date

2007-04-12 Thread Jeffrey Melloy
On 4/11/07, Raymond O'Donnell <[EMAIL PROTECTED]> wrote: Hi all, This is probably a very simple one, but I just can't see the answer and it's driving me nuts. I have a table holding details of academic terms, and I need an SQL query such that for any given term I want to find the next term by s

Re: [GENERAL] SQL - finding next date

2007-04-11 Thread Jeffrey Melloy
On 4/11/07, Raymond O'Donnell <[EMAIL PROTECTED]> wrote: Hi all, This is probably a very simple one, but I just can't see the answer and it's driving me nuts. I have a table holding details of academic terms, and I need an SQL query such that for any given term I want to find the next term by s

Re: [GENERAL] is there a tracking trace tool like the "SQL Analizer" in MS sqlserver.?

2007-01-09 Thread Jeffrey Melloy
Not exactly. SQL Analyzer also includes live monitoring of whatever queries are coming into the database. You can achieve something similar by enabling query logging in the settings. On 1/8/07, Ian Harding <[EMAIL PROTECTED]> wrote: There is no GUI tool that I know of, but there is EXPLAIN wh

Re: [GENERAL] is there a tracking trace tool like the "SQL Analizer

2007-01-08 Thread Jeffrey Melloy
How long has that been available for OS X? Last time I looked at it it wasn't. On 1/8/07, Dave Page <[EMAIL PROTECTED]> wrote: > --- Original Message --- > From: "Ian Harding" <[EMAIL PROTECTED]> > To: "Jeffrey Melloy" <[EMAIL PRO

Re: [GENERAL] is there a tracking trace tool like the "SQL Analizer" in MS sqlserver.?

2007-01-08 Thread Jeffrey Melloy
I have not heard of such a thing for PostgreSQL, although I am sure the basic information you want could be obtained from logging queries and timing. - Ian On 1/8/07, Jeffrey Melloy <[EMAIL PROTECTED]> wrote: > Not exactly. SQL Analyzer also includes live monitoring of whatever queries &

Re: [GENERAL] is there a tracking trace tool like the "SQL Analizer" in MS sqlserver.?

2007-01-08 Thread Jeffrey Melloy
On 1/8/07, Jeffrey Melloy <[EMAIL PROTECTED]> wrote: Not exactly. SQL Analyzer also includes live monitoring of whatever queries are coming into the database. You can achieve something similar by enabling query logging in the settings. On 1/8/07, Ian Harding <[EMAIL PROTECTE

Re: [GENERAL] Search by distance

2006-04-10 Thread Jeffrey Melloy
Oscar Picasso wrote: HI, I would like to implement a search by distance to my application. Something like (pseudo sql): select * from users where users.location is less than 15 miles from chicago. Any documentation on how to implements that? I guess I also need a database of the cities coor

Re: [GENERAL] PSQL Data Type: text vs. varchar(n)

2006-04-05 Thread Jeffrey Melloy
Patrick TJ McPhee wrote: In article <[EMAIL PROTECTED]>, Jim Nasby <[EMAIL PROTECTED]> wrote: % Not sure if it's still true, but DB2 used to limit varchar to 255. I % don't think anyone limits it lower than that. Sybase: 254. Silently truncates. IIRC, Oracle is 4096. Jeff ---

Re: [GENERAL] Advantages of PostgreSQL over MySQL 5.0

2006-03-22 Thread Jeffrey Melloy
Jimbo1 wrote: Hello there, I'm a freelance Oracle Developer by trade (can almost hear the boos now ;o)), and am looking into developing my own Snowboarding-related website over the next few years. Anyway, I'm making some decisions now about the site architecture, and the database I'm going to n

Re: [GENERAL] find last day of month

2005-12-08 Thread Jeffrey Melloy
Andrus Moor wrote: I have a table containing month column in format mm. create table months ( tmkuu c(7)); insert into months values ('01.2005'); insert into months values ('02.2005'); How to create select statement which converts this column to date type containing last day of month like

Re: [GENERAL] fts, compond words?

2005-12-07 Thread Jeffrey Melloy
Mike Rylander wrote: Mike Rylander wrote: On 12/6/05, Marcus Engene <[EMAIL PROTECTED]> wrote: [snip] A & (B | (New OperatorTheNextWordMustFollow York)) Actually, I love that idea. Oleg, would it be possible to create a tsquery operator that understands proximity?

Re: [GENERAL] is there a function which elminates spaces?

2005-10-24 Thread Jeffrey Melloy
codeWarrior wrote: SELECT trim(trailing ' ' from city_name) AS city_name FROM sys_cities; You might consider reading the manual as there are a multitude of string manipulation functions built into postgreSQL You didn't answer his question. If you're going to rag on someone for not read

Re: [GENERAL] PostgreSQL 8.1 vs. MySQL 5.0?

2005-10-15 Thread Jeffrey Melloy
On Oct 13, 2005, at 12:00 PM, Alex Turner wrote: > >Instance Manager: Uniquely MySQL. It allows things like starting and >stopping the database remotely. > > I cannot think of a reason ever to need this when we have OpenSSH I'm just curious, but how does this work for a windows bo

Re: [pgsql-advocacy] [GENERAL] Oracle buys Innobase

2005-10-14 Thread Jeffrey Melloy
Joshua D. Drake wrote: Bruce Momjian wrote: Matthew Terenzio wrote: As much as I respect Marc and Postgresql.org, I can't see Oracle hiring him away as a "killer" threat to the community. People would set up camp somewhere else, like Command Prompt. It would hurt things for a while but t

Re: [GENERAL] PostgreSQL Gotchas

2005-10-06 Thread Jeffrey Melloy
Neil Conway wrote: "COUNT(*) very slow": this is a known issue -- see the -hackers archives for many prior discussions. MVCC makes this hard to solve effectively (whether applications should actually be using COUNT(*) on large tables with no WHERE clause is another matter...) -Neil And it's

Re: [GENERAL] POSS. FEATURE REQ: "Dynamic" Views

2005-08-29 Thread Jeffrey Melloy
Greg Stark wrote: Bruce Momjian writes: Well, I just added to TODO: * Allow VIEW/RULE recompilation when the underlying tables change Is dynamic view a industry-standard name? If so, I will add it to the TODO. "DYNAMIC" is something I made up. "ALTER VIEW RECOMPILE" is O

Re: [GENERAL] Tool for database design documentation?

2005-07-30 Thread Jeffrey Melloy
On Jul 30, 2005, at 2:30 PM, Jon Christian Ottersen wrote:We are trying to find a good way to document our database design – what is the rationale behind each table/field, what kind of information is each field supposed to contain, perhaps also something about the linking between the tables etc. Is

[GENERAL] Table Update Systems (was: chosing a database name)

2005-07-13 Thread Jeffrey Melloy
I think a better approach is to handle configuration management with a table in each schema. Update the schema, update the table. This works well with automating database upgrades as well, where upgrades are written as scripts, and applied in a given order to upgrade a database from release A

Re: [GENERAL] Need help writing SQL statement

2005-06-29 Thread Jeffrey Melloy
D A GERM wrote: I have been trying to write an sql statement that returns the same hours in a time stamp no matter what the date. I can to pull same hours on the the same days but have not been able to figure out how to pull all the same hours no matter what the date. Here is the one sql stat

Re: [GENERAL] Days in month query

2005-03-30 Thread Jeffrey Melloy
Or select date_part('day', date_trunc('month', '01/10/04') + '1 month'::interval - '1 day'::interval) as days; or select date_part('day', to_date('mon', 'Jan') + '1 month'::interval - '1 day'::interval) as days; Arthur Hoogervorst wrote: Hi, Something like this? SELECT date_part('day',

Re: [GENERAL] SCHEMA compatibility with Oracle/DB2/Firebird

2005-01-23 Thread Jeffrey Melloy
Chris wrote: I know this isn't entirely postgresql specific, but it wouldn't be on another list either so here goes... I am writing an open source application where I would like to support at least oracle, and possibly firebird or DB2, in addition to postgresql which will be the default. I'm not g

Re: [GENERAL] Index on a view??

2005-01-05 Thread Jeffrey Melloy
Ragnar Hafstað wrote: On Wed, 2005-01-05 at 13:03 -0800, Jeff Davis wrote: On Wed, 2005-01-05 at 13:14 -0700, Michael Fuhr wrote: On Wed, Jan 05, 2005 at 08:15:28PM +0100, Joost Kraaijeveld wrote: [snip] PostgreSQL doesn't have materialized views per se but it does have function

Re: [GENERAL] Memory Errors OS X

2004-12-22 Thread Jeffrey Melloy
Tom Lane wrote: Jeffrey Melloy <[EMAIL PROTECTED]> writes: I attempted to install 8.0 RC 2 alongside 7.4.5 on my OS X box, but initdb failed with an error about not enough shared memory. Don't forget that both shmmax and shmall may need attention ... and, just to confuse matter

[GENERAL] Memory Errors OS X

2004-12-22 Thread Jeffrey Melloy
it: http://www.visualdistortion.org/misc/dont_do_this.png) Jeffrey Melloy [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your messa

Re: [GENERAL] combining two queries?

2004-10-25 Thread Jeffrey Melloy
If you want to return rows with zeros, you may need to do something like this: select b.name as viewer, count(viewerid) from xenons b left join viewer_movies a on (b.id = a.viewerid) group by b.name Eddy Macnaghten wrote: select b.name as viewer, count(*) from viewer_movies a, xenons b where b.id

Re: [GENERAL] Out of memory errors on OS X

2004-09-29 Thread Jeffrey Melloy
Tom Lane wrote: Jeffrey Melloy <[EMAIL PROTECTED]> writes: I have a couple users trying to install Postgres on OS X. To the best of my knowledge, both of them are using 7.4.5/10.3.5, and got identical errors while trying to init the database: They need to increase the system&#x

[GENERAL] Out of memory errors on OS X

2004-09-29 Thread Jeffrey Melloy
I have a couple users trying to install Postgres on OS X. To the best of my knowledge, both of them are using 7.4.5/10.3.5, and got identical errors while trying to init the database: Reducing the shared buffers didn't help. Any thoughts would be appreciated. Jeffrey Melloy [EMAIL PROT

Re: [GENERAL] Installing FullTextSearchTool tsearch2

2004-08-18 Thread Jeffrey Melloy
Oleg Bartunov wrote: Marcel, it's very difficult from you message where do you lost. pgsql version, OS version, cut'n paste of commands you run and output would be fine. To install tsearch2 most people need (as postgresql superuser): 1. install postgresql and headers 2. cd contrib/tsearch2 3. make;

[GENERAL] Renaming a schema

2004-06-24 Thread Jeffrey Melloy
Recently, I decided to rename one of my schemas from "adium" to "im". Then, all inserts started failing. I recreated a couple functions, changed the search path, and all inserts are still failing due to referential integrity checks going against "adium" still. Is there any way I can fix this, sh

Re: [GENERAL] Humor me: Postgresql vs. MySql (esp. licensing)

2003-10-09 Thread Jeffrey Melloy
On Thursday, October 9, 2003, at 01:42 AM, Shridhar Daithankar wrote: [EMAIL PROTECTED] wrote: One of my friend lost data with mysql yesterday.. The machine was taken down for disk upgrade and mysql apperantly did not commit the last insert.. OK he was using myisam but still..:-) It sounds lik

Re: [GENERAL] SELECT Question

2003-08-31 Thread Jeffrey Melloy
If I'm understanding you correctly, you can do something like: select cola, colb, exists (select 'x' from tableb where colc = colb) from tablea Since that has a subselect, you may get better performance with something li

Re: [GENERAL] Join question

2003-08-29 Thread Jeffrey Melloy
On Thursday, August 28, 2003, at 09:03 PM, Williams, Travis L, NEO wrote: I have a table1 with 2 col (a & b) where b can sometimes be null. I need a query that if B is null I get back the contents of A.. but if B is not null I do a "select d from table2 where d like '%b%'" There is nothing to jo

Re: [GENERAL] Books for PostgreSQL?

2003-08-28 Thread Jeffrey Melloy
On Thursday, August 28, 2003, at 08:58 AM, Dennis Gearon wrote: Heath Tanner wrote: Not to take anything away from the books on the topic, but my favorite source is the docs that got installed with postgres (/usr/local/pgsql/doc/html). The index isn't great, but easily overcome: grep -i "sear

Re: [GENERAL] pgplsql - Oracle nvl

2003-08-27 Thread Jeffrey Melloy
Hi, I'll try to switch from Oracle to postgres for some small applications. Is it possible to build functions like Oracle's nvl or decode with pgplsql? How can I make a function like nvl that works for every datatype? Best regards, Christian Try coalesce. The syntax is the same as nvl. Jeff -

[GENERAL] 'now' vs now() performance

2003-08-18 Thread Jeffrey Melloy
I was recently running into performance problems with a query containing now()::date or CURRENT_DATE. When I went to debug, 'now'::date made efficient use of the index (on a timestamp field). The docs say that 'now' is turned into a constant right away. Is this overhead/poor planning simpl

Re: [GENERAL] Graphical Mapping a Database

2003-08-15 Thread Jeffrey Melloy
If you don't mind spending a little money and are on Windows, you can use Microsoft Visio Professional. On Saturday, August 16, 2003, at 01:38 AM, Ron Johnson wrote: On Thu, 2003-08-14 at 23:17, David Fetter wrote: "Tim Edwards" <[EMAIL PROTECTED]> wrote: I have been request to create a relati

Re: [GENERAL] Sorting Problem

2003-08-14 Thread Jeffrey Melloy
It does if you look at the original email. Maksim must've just transposed a couple letters when he was writing his demo. Jeff Kathy zhu wrote: If it skips "-", then RMT-* should come before RM-V*, but they don't, why ?? Maksim Likharev wrote: en_US locale skips? punctuation from sorting in

Re: [GENERAL] Am I using the SERIAL type properly?

2003-07-12 Thread Jeffrey Melloy
If you use a serial datatype, it simply says "the *default* behavior is to use the next value of sequence a". So you can insert 1, 2, 10,204,492 into the column just fine. However, by inserting data into something you want to auto-increment, you can run into non-uniqueness. (Like you were).

Re: [GENERAL] Am I using the SERIAL type properly?

2003-07-11 Thread Jeffrey Melloy
drop table A; create table A ( id SERIAL PRIMARY KEY, foo int default 5, bar int default 10 ); insert into A (id, foo, bar) values (1, 1, 1); insert into A (id, foo, bar) values (2, 2, 2); insert into A (id, foo, bar) values (3, 3, 3); insert into A (id, foo, bar) v