[GENERAL] PostgreSQL code for nested sets

2005-01-15 Thread Jim C. Nasby
I'm wondering if anyone has taken the code from http://www.dbazine.com/tropashko4.shtml and converted it to PostgreSQL? -- Jim C. Nasby, Database Consultant [EMAIL PROTECTED] Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today

Re: [GENERAL] PostgreSQL code for nested sets

2005-01-15 Thread Michael Glaesemann
On Jan 16, 2005, at 15:20, Jim C. Nasby wrote: At least two. Here's one (blatant plug): http://www.grzm.com/fornow/archives/2004/07/10/static_hierarchies The other (which preceded mine) in the archives: http://archives.postgresql.org/pgsql-general/2003-12/msg00247.php The later Tropashko stuff is i

Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4

2005-01-15 Thread Stuart Bishop
Tom Lane wrote: Stuart Bishop <[EMAIL PROTECTED]> writes: Marc G. Fournier wrote: | A current list of *known* supported platforms can be found at: | http://developer.postgresql.org/supported-platforms.html I notice that Ubuntu is not yet on this list. I can confirm that PostgreSQL 7.4.5 is sup

[GENERAL] PostgreSQL and WebObjects

2005-01-15 Thread Ken Tozier
Anybody using PostgreSQL with WebObjects on OS X 10.3.x? I'm having trouble setting it up and could use some pointers from anyone who has successfully gotten the two working together. Thanks Ken ---(end of broadcast)--- TIP 4: Don't 'kill -9' the p

Re: [GENERAL] Is it possible to measure IO costs of a query in postgreSQL?

2005-01-15 Thread Michael Fuhr
On Sat, Jan 08, 2005 at 08:01:51PM +0200, Tzahi Fadida wrote: > I have been trying for a week now without success to discover > if you can measure the cost of a query (with my c function). > EXPLAIN ANALYZE seems to give you the actual time it took it > to run but the "cost" seems to be a fixed es

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Jim C. Nasby
On Sat, Jan 15, 2005 at 06:34:11PM -0300, Alvaro Herrera wrote: > On Sat, Jan 15, 2005 at 03:11:22PM -0600, Jim C. Nasby wrote: > > > Would it make sense to have a version of currval that will only return > > one value in a statement/transaction? So the first time it's called it > > remembers what

Re: [GENERAL] PQexecParams and CURSOR

2005-01-15 Thread Michael Fuhr
On Fri, Jan 14, 2005 at 12:31:24PM +0100, Laurent Marzullo wrote: > paramValues[0] = "2"; // This is the parameter for the query > > res = PQexecParams( conn , > "DECLARE MY_CURSOR FOR " > "SELECT * FROM GRGL.RANGE_MODIFIER " > "WHERE WEAPON_ID = $1", > 1, > NULL, > paramValues, > N

Re: [GENERAL] Multi-column indexes

2005-01-15 Thread Edmund Dengler
Hi Tom! Yep, there are a large number of host_luid/log_luid combinations (there are approximatly 5-10 hosts and 1-3 logs per system we are running). Thanks for the recommended workaround, I'll have a try at it at some point tomorrow. Regards! Ed On Sat, 15 Jan 2005, Tom Lane wrote: > Edmund D

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Michael Fuhr
On Sat, Jan 15, 2005 at 11:28:08PM +0100, Bo Lorentsen wrote: > Michael Fuhr wrote: > > >currval() is volatile. See "Function Volatility Categories" in the > >"Extending SQL" chapter of the documentation and search the list > >archives for past discussion of currval()'s volatility. > > > Hmm, I c

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Tom Lane
Bo Lorentsen <[EMAIL PROTECTED]> writes: > Do you have any idea to how I may learn more about function types, or is > this a "read the source, luke" thing (I am not sure I have time for that > right now) ? http://developer.postgresql.org/docs/postgres/xfunc-volatility.html

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Bo Lorentsen
Michael Fuhr wrote: currval() is volatile. See "Function Volatility Categories" in the "Extending SQL" chapter of the documentation and search the list archives for past discussion of currval()'s volatility. Hmm, I can't find that chapter in the 7.4 manual, or am I looking the wrong place ? I

Re: [GENERAL] Multi-column indexes

2005-01-15 Thread Tom Lane
Edmund Dengler <[EMAIL PROTECTED]> writes: > "record_to_process_idx" unique, btree (host_luid, log_luid, luid) WHERE > (error IS NULL) > explain analyze > select record > from agent.record > where host_luid = 3::bigint > and log_luid = 2::bigint > and error is null > order by host_luid de

Re: [GENERAL] OID Usage

2005-01-15 Thread Bo Lorentsen
Martijn van Oosterhout wrote: Not quite, a single index entry needs to point to any number of rows, which may or may not be visible depending on your transaction, so they form a sort of linked list. But indeed, not terribly useful for your purpose... This make's sense, I keep forgetting the vers

Re: [GENERAL] Multi-column indexes

2005-01-15 Thread Martijn van Oosterhout
On Sat, Jan 15, 2005 at 04:00:03PM -0500, Edmund Dengler wrote: > Greetings! > > I have a technical question concerning multi-column indexes and their > implementation. I tried looking for the answr in the docs but couldn't > find anything. > I guess it breaks down to how these indexes are imple

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Bo Lorentsen
Tom Lane wrote: This is not legally optimizable into an indexscan, because currval() is a volatile function. (It's easy to construct cases where its value actually does change from row to row --- just use a nextval() as well.) I am not sure what you mean by a "volatile function", and how this

Re: [GENERAL] OID Usage

2005-01-15 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Which reminds me that you wanted to make VACUUM FULL do the equivalent > of a REINDEX instead of retail deletion of index entries ... is that > still the idea? Would it do that always, or only under certain > conditions? It's still on the to-do list.

Re: [GENERAL] Pgsql taking a *lot* of CPU time (unkillable).

2005-01-15 Thread Berteun Damman
On Sat, 15 Jan 2005 16:25:34 -0500, Tom Lane <[EMAIL PROTECTED]> wrote: > You don't need to reproduce the bug from scratch each time. What I > meant was, once it seems to be spinning, repeatedly attach to it with > gdb and see if you can get a backtrace. If not, just quit gdb and try > again. Oh

Re: [GENERAL] OID Usage

2005-01-15 Thread Bruce Momjian
Alvaro Herrera wrote: > On Sat, Jan 15, 2005 at 04:21:24PM -0500, Tom Lane wrote: > > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > > Out of curiosity, what clears out the old index tuples? Vacuum? > > > > Right. > > Which reminds me that you wanted to make VACUUM FULL do the equivalent > of a R

Re: [GENERAL] PQisBusy() always returns TRUE

2005-01-15 Thread ntinos
Martijn van Oosterhout writes: On Sat, Jan 15, 2005 at 09:50:35PM +0200, [EMAIL PROTECTED] wrote: PQconsumeInput(conn);//Try to collect the results while (PQisBusy(conn)) // while not ready ... PQconsumeInput(conn); //...retry res=PQgetResult(conn); // Now get the results

Re: [GENERAL] OID Usage

2005-01-15 Thread Alvaro Herrera
On Sat, Jan 15, 2005 at 04:21:24PM -0500, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > Out of curiosity, what clears out the old index tuples? Vacuum? > > Right. Which reminds me that you wanted to make VACUUM FULL do the equivalent of a REINDEX instead of retail deletion of i

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Alvaro Herrera
On Sat, Jan 15, 2005 at 03:11:22PM -0600, Jim C. Nasby wrote: > Would it make sense to have a version of currval that will only return > one value in a statement/transaction? So the first time it's called it > remembers what currval for that sequence is and always returns the same > value? What w

Re: [GENERAL] OID Usage

2005-01-15 Thread Jim C. Nasby
On Sat, Jan 15, 2005 at 04:00:19PM -0500, Tom Lane wrote: > Martijn van Oosterhout writes: > > On Sat, Jan 15, 2005 at 07:10:48PM +0100, Bo Lorentsen wrote: > >> Hmm, so a data row update also update the CTID in all indexes, too. I=20 > >> see what you mean ! > > > Not quite, a single index entry

Re: [GENERAL] OID Usage

2005-01-15 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > Out of curiosity, what clears out the old index tuples? Vacuum? Right. regards, tom lane ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http:/

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Jim C. Nasby
On Sat, Jan 15, 2005 at 01:27:49PM -0500, Tom Lane wrote: > Bo Lorentsen <[EMAIL PROTECTED]> writes: > > select * from sale where id = currval( 'sale_id_seq' ); > > This is not legally optimizable into an indexscan, because currval() is > a volatile function. (It's easy to construct cases where i

[GENERAL] Multi-column indexes

2005-01-15 Thread Edmund Dengler
Greetings! I have a technical question concerning multi-column indexes and their implementation. I tried looking for the answr in the docs but couldn't find anything. I have the following table: eventlog=> \d agent.record Table "agent.record" Colu

Re: [GENERAL] OID Usage

2005-01-15 Thread Tom Lane
Martijn van Oosterhout writes: > On Sat, Jan 15, 2005 at 07:10:48PM +0100, Bo Lorentsen wrote: >> Hmm, so a data row update also update the CTID in all indexes, too. I=20 >> see what you mean ! > Not quite, a single index entry needs to point to any number of rows, > which may or may not be visib

Re: [GENERAL] PQisBusy() always returns TRUE

2005-01-15 Thread Martijn van Oosterhout
On Sat, Jan 15, 2005 at 09:50:35PM +0200, [EMAIL PROTECTED] wrote: > If understand correctly what you are saying, the right code for this thing > is: > > PQconsumeInput(conn);//Try to collect the results > while (PQisBusy(conn)) // while not ready ... > PQconsumeInput(conn);

Re: [GENERAL] OID Usage

2005-01-15 Thread Martijn van Oosterhout
On Sat, Jan 15, 2005 at 07:10:48PM +0100, Bo Lorentsen wrote: > >Using the CTID, which locates the physical tuple as (block,num). When > >you update a tuple, or vacuum moves it its CTID will change, so it's > >not terribly useful from a user's point of view. > > > Hmm, so a data row update also upd

Re: [GENERAL] Pgsql taking a *lot* of CPU time (unkillable).

2005-01-15 Thread Tom Lane
Berteun Damman <[EMAIL PROTECTED]> writes: > On Sat, 15 Jan 2005 13:15:36 -0500, Tom Lane <[EMAIL PROTECTED]> wrote: >> Would you attach to the process with a debugger and get a stack trace? > I think it has a locking problem: > #0 0x483bbb2e in pthread__lock_ras_end () from /usr/lib/libpthread.s

[GENERAL] pg_dump shell script with ~/.pgpass

2005-01-15 Thread MargaretGillon
I need to create a shell script for cron.daily to run that will do pg_dump for my database. I am using Redhat 9 and Postgresql v7.3.4. Currently when I run the dump manually the command I use is #pg_dump -u -C -D -f /tmp/owl.sql owl What should the command look like using ~/.pgpass ? My other q

Re: [GENERAL] PQisBusy() always returns TRUE

2005-01-15 Thread ntinos
If understand correctly what you are saying, the right code for this thing is: PQconsumeInput(conn);//Try to collect the results while (PQisBusy(conn)) // while not ready ... PQconsumeInput(conn); //...retry res=PQgetResult(conn); // Now get the results I tried this and

Re: [GENERAL] Pgsql taking a *lot* of CPU time (unkillable).

2005-01-15 Thread Berteun Damman
On Sat, 15 Jan 2005 13:15:36 -0500, Tom Lane <[EMAIL PROTECTED]> wrote: > Would you attach to the process with a debugger and get a stack trace? > > $ gdb /usr/pkg/bin/postgres PID-of-process > gdb> bt > gdb> q > > Probably should repeat this a few times to get a clear sen

Re: [GENERAL] OID Usage

2005-01-15 Thread PFC
Uh, sorry, my mistake ! I had put SERIAL instead of an INTEGER in the table definition ! You just removed a bug in my schema ;) On Sat, Jan 15, 2005 at 09:02:12AM +0100, PFC wrote: As a sidenote, I have a table with a primary key which is not a sequence, and this query displa

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Michael Fuhr
On Sat, Jan 15, 2005 at 07:03:43PM +0100, Bo Lorentsen wrote: > select * from sale where id = currval( 'sale_id_seq' )::bigint; > > But this still did not work (still using seq scan) :-( currval() is volatile. See "Function Volatility Categories" in the "Extending SQL" chapter of the documentat

Re: [GENERAL] Index optimization ?

2005-01-15 Thread Tom Lane
Bo Lorentsen <[EMAIL PROTECTED]> writes: > select * from sale where id = currval( 'sale_id_seq' ); This is not legally optimizable into an indexscan, because currval() is a volatile function. (It's easy to construct cases where its value actually does change from row to row --- just use a nextval

Re: [GENERAL] Pgsql taking a *lot* of CPU time (unkillable).

2005-01-15 Thread Tom Lane
Berteun Damman <[EMAIL PROTECTED]> writes: > After I've finished using it, and leaving it to itself for a while, it > starts to consume all CPU time for, apparently, no good reason > (because it's not doing anything). Would you attach to the process with a debugger and get a stack trace?

Re: [GENERAL] OID Usage

2005-01-15 Thread Bo Lorentsen
Martijn van Oosterhout wrote: But where in the documentation did you see anything saying that they were unique? I imagine you just inferred that from somewhere. I'm not sure where the documentation should be changed since nowhere actually recommends them in any way. Hmm, how about as a comment n

[GENERAL] Index optimization ?

2005-01-15 Thread Bo Lorentsen
Hi ... In my quest to get rid of the oid dependency, i have made some new low level code with the help from many nice people from this community (thanks for that), but I still have one somewhat big problem. I am running PG 7.4.6, btw. I have a "sale" table that have a BIGSERIAL as primary key, b

Re: [GENERAL] PQisBusy() always returns TRUE

2005-01-15 Thread Tom Lane
[EMAIL PROTECTED] writes: >if (PQconsumeInput(conn)!=1) elog(ERROR,"Error in consume..."); > else > { > elog(INFO,"OK with PQconsumeInput"); >//Will use a cursor and 'while' later when this >//will have been fixed... >

Re: [GENERAL] OID Usage

2005-01-15 Thread Michael Fuhr
On Sat, Jan 15, 2005 at 05:53:08PM +0100, Bo Lorentsen wrote: > Michael Fuhr wrote: > > >The view assumes single-column primary keys defined as SERIAL types. > > > is this the "c2.relkind = 'S'" in the view ? That restricts the view to show only dependent objects that are sequences ('S'). Defini

Re: [GENERAL] OID Usage

2005-01-15 Thread Alvaro Herrera
On Sat, Jan 15, 2005 at 05:53:08PM +0100, Bo Lorentsen wrote: > Michael Fuhr wrote: > >The view assumes single-column primary keys defined as SERIAL types. > > is this the "c2.relkind = 'S'" in the view ? No, that means the pg_class entry is a sequence. -- Alvaro Herrera (<[EMAIL PROTECTED]>) "

Re: [GENERAL] ntfs for windows port rc5-2

2005-01-15 Thread Magnus Hagander
>rc5-2 msi will not install at all on a fat32 filesystem >even without initialising the database. Really? The code for checking the filesystem type is only executed if you chose to initdb, so I really don't see this happening. Exactly what message do you get? >sorry but whole purpose of putting i

Re: [GENERAL] serial increments on failed insert

2005-01-15 Thread David Fetter
On Fri, Jan 14, 2005 at 04:48:12PM -0800, David Kammer wrote: > Ive noticed what seems to be an odd effect in psql 7.3. It works like this: > > 1> Create a table: > CREATE TABLE foo > ( > sval serial, > uval int UNIQUE > ); > > 2> Run 3 inserts, the second of which fails because it fails the

Re: [GENERAL] PL/PgSQL Boolean Comparison Operator Binding

2005-01-15 Thread Thomas F . O'Connell
Never mind. I think I had some data that hadn't been calibrated lying around prior to testing. I think my test case was flawed. Sorry for the noise. -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37

Re: [GENERAL] OID Usage

2005-01-15 Thread Bo Lorentsen
PFC wrote: As a sidenote, I have a table with a primary key which is not a sequence, and this query displays the non-existing sequence name. It would be easy to check if the sequence exists (yet another join !), only display sequences that exist ;)... Hmm, I just tried the same, and got a

Re: [GENERAL] OID Usage

2005-01-15 Thread Martijn van Oosterhout
On Sat, Jan 15, 2005 at 05:11:16PM +0100, Bo Lorentsen wrote: > Alvaro Herrera wrote: > >Most system catalogs use OIDs as primary keys. So they cannot just > >disappear. But on user tables, there's not a lot of use for them IMHO. > > > Ok, I think it is about time it is stated more clearly in the

Re: [GENERAL] OID Usage

2005-01-15 Thread Bo Lorentsen
Michael Fuhr wrote: Here's a first attempt at a view that shows tables and their primary key columns and sequences. I chose a view instead of a function because a view shows everything in the database with a single query, which simplifies visual examination of the results. Modify it or convert it

[GENERAL] PL/PgSQL Boolean Comparison Operator Binding

2005-01-15 Thread Thomas F . O'Connell
I was recently testing some logic based on columns of type boolean and noticed some unintuitive behavior in PL/PgSQL. I had a construct like the following: IF NOT col1 AND NOT col2 THEN ... In a scenario where both col1 and col2 were false, this condition was not triggered. If I rewrote it as:

Re: [GENERAL] OID Usage

2005-01-15 Thread Bo Lorentsen
Alvaro Herrera wrote: Most system catalogs use OIDs as primary keys. So they cannot just disappear. But on user tables, there's not a lot of use for them IMHO. Ok, I think it is about time it is stated more clearly in the documentation. There's no internal row id on Postgres; having one would

[GENERAL] Pgsql taking a *lot* of CPU time (unkillable).

2005-01-15 Thread Berteun Damman
Hello, I'm currently running PostgreSQL 7.4.6 under NetBSD 2.0 (Release), but with a custom kernel. I can start it, and it performs normally, i.e. I can access my databases and such. Now I'm primarily using it with the GNUCash PostgreSQL backend. After I've finished using it, and leaving it to it

Re: [GENERAL] is there anyway to get the backends IP address from the PID?

2005-01-15 Thread Michael Fuhr
On Fri, Jan 14, 2005 at 02:29:47PM -0600, Tony Caduto wrote: > Does anyone know if there is a way to get the backends IP address from > the PID? Do you mean the IP address of the backend (the server) or the address of the client that's using that backend? PostgreSQL 8.0 will have inet_client_ad

Re: [GENERAL] PostGreSQL on Access Report

2005-01-15 Thread Pavel Stehule
> 5) One trick I learned is that Access does not refresh any ODBC properties > except for the server name when you Refresh Linked Tables and Choose a > different location. To change other settings you have to delete the linked > table and relink it. Hello, I know so You can use addin for Access, l

Re: [GENERAL] PostgreSQL v7.3.6

2005-01-15 Thread Pavel Stehule
> > Could you provide me with a link to where I can download v7.3.6 of > PostgreSQL for win32, > > This is for some testing of mine, Thanks in advanced. > > Hello, The first native official version PostgreSQL for win32 is v8.0.0. Before You can use only 7.2.1 http://postgresql.ok.cz/download

[GENERAL] PQisBusy() always returns TRUE

2005-01-15 Thread ntinos
Hi, I'm writing some code for asychronous command processing and I experience the following problem. Everything seems to be OK (by following the documentation) until I call PQisBusy(). While PQconsumeInput() returns 1, PQisBusy() always returns 1! This is the code: --

Re: [GENERAL] OID Usage

2005-01-15 Thread Michael Fuhr
On Sat, Jan 15, 2005 at 09:02:12AM +0100, PFC wrote: > > As a sidenote, I have a table with a primary key which is not a > sequence, and this query displays the non-existing sequence name. It > would > be easy to check if the sequence exists (yet another join !), only display > se

Re: [GENERAL] serial increments on failed insert

2005-01-15 Thread Bruno Wolff III
On Fri, Jan 14, 2005 at 17:49:42 -0800, Steve Atkins <[EMAIL PROTECTED]> wrote: > > That's correct, documented behaviour. A serial column is mostly just a > sequence in disguise. A sequence is guaranteed to give unique, > increasing values, but in many cases may miss a value (for several > reaso

Re: [GENERAL] to_char(interval, text) deprecated in future - how do we get consistent interval output without it?

2005-01-15 Thread Bruno Wolff III
On Fri, Jan 14, 2005 at 11:36:26 -0800, [EMAIL PROTECTED] wrote: > I saw the note in the docs that to_char(interval, text) is deprecated, and > will be removed. I searched the archives and saw more mentions of this, > but no real explanation as to how it is planned for us to get consistent > out

Re: [GENERAL] OID Usage

2005-01-15 Thread PFC
I've done only trivial testing, so if anybody finds a situation where the view fails (taking the above assumption into account) then please describe it. Nice ! As a sidenote, I have a table with a primary key which is not a sequence, and this query displays the non-existing sequence name. It w