Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Stuart McGraw
Glenn Maynard wrote: (JMdict? yup. ;-) I was playing with importing that into a DB a while back, but the attributes in that XML are such a pain--and then my email died while I was trying to get those changed, and I never picked it up again.) On Mon, Apr 13, 2009 at 1:20 PM, Stuart McGraw

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Stuart McGraw
Scott Marlowe wrote: 2009/4/7 Stuart McGraw : Hello all, I have a table with a primary key column that contains sequential numbers. Sometimes I need to shift them all up or down by a fixed amount. For example, if I have four rows with primary keys, 2, 3, 4, 5, I might want to shift them down

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Stuart McGraw
Jasen Betts wrote: On 2009-04-08, Stuart McGraw wrote: Hello all, I have a table with a primary key column that contains sequential numbers. Sometimes I need to shift them all up or down by a fixed amount. For example, if I have four rows with primary keys, 2, 3, 4, 5, I might want to

[SQL] changing multiple pk's in one update

2009-04-07 Thread Stuart McGraw
Hello all, I have a table with a primary key column that contains sequential numbers. Sometimes I need to shift them all up or down by a fixed amount. For example, if I have four rows with primary keys, 2, 3, 4, 5, I might want to shift them down by 1 by doing: UPDATE mytable SET id=id-1 (

[SQL] data dependent sequences?

2007-07-15 Thread Stuart McGraw
Advice requested :-) I have a table like: CREATE TABLE items ( id INT, typ INT... PRIMAY KEY (seq,typ)); I would like 'id' to be like a SERIAL except that I want independent sequences for each value of 'typ'. So if 'items' is: id typ +- 1 'a' 2 'a'

Re: [SQL] slowness when subselect uses DISTINCT

2007-04-19 Thread Stuart McGraw
Phillip Smith wrote: > May I suggest you post an EXPLAIN ANALYZE to the group for the query you're > having problems with...? I will do that but it has happened to me enough that it seems to be a general pattern, not something specific to one of my queries, so I thought some communal knowledge ma

[SQL] slowness when subselect uses DISTINCT

2007-04-18 Thread Stuart McGraw
I have several times now run into what seems like similar performance problems with some of my postgresql queries. I have a view that runs reasonably quicky. I use this view in a subselect in another query and that query too runs reasonably quicky. The view returns some unwanted duplicate row

[SQL] equiv of ascii() function for unicode?

2007-04-18 Thread Stuart McGraw
Does postgresql have a function that will give me the numeric unicode code point for a character in a unicode (aka utf8) database text string? That is, something like ascii() but that works for unicode characters? ---(end of broadcast)--- TIP 2:

Re: [SQL] slow view

2006-10-11 Thread Stuart McGraw
On 2006/10/11 Stuart wrote: > [..] Apologies for following up my own post, but after struggling with that query for over a day, I figured out the answer within thirty minutes of posting. (Sigh) My slow query was: > SELECT p.id AS pid, a.id AS aid, sub.bid AS bid > FROM p > JOIN a ON