Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Michael Fuhr
On Fri, Oct 15, 2004 at 10:56:06PM -0500, Josh Close wrote: > FOR this_rSum IN EXECUTE this_sQuery LOOP > this_iSum := this_rSum.isum; > END LOOP; > this_iTotal := this_iTotal + this_iSum; [snip] > If I return this_iSum or this_iTotal in the loop, I get a value. I

Re: [GENERAL] Avoiding sequential scans with OR join condition

2004-10-16 Thread Janning Vygen
Am Samstag, 16. Oktober 2004 07:23 schrieb Mike Mascari: > Hello. I have a query like: > > SELECT big_table.* > FROM little_table, big_table > WHERE little_table.x = 10 AND > little_table.y IN (big_table.y1, big_table.y2); > > I have indexes on both big_table.y1 and big_table.y2 and on > little_tab

Re: [GENERAL] OS X Install

2004-10-16 Thread John DeSoi
On Oct 15, 2004, at 8:09 PM, Nathan Mealey wrote: I am trying to install PostgreSQL on OS X 10.3, using the package from Entropy.ch. The installation instructions there, as well as anywhere else I have seen them on the net, say to create a user (using the System Preferences pane) with a shortna

Re: [GENERAL] Avoiding sequential scans with OR join condition

2004-10-16 Thread Martijn van Oosterhout
If the problem is the sort, use UNION ALL. As for the query restructuring, I don't know if there is a way of restructuring the query to do it in a single query. You would be able to contruct a query plan that would do it, something like: -> Nested Loop -> Append -> Index Scan on big_table.y

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Josh Close
On Sat, 16 Oct 2004 00:59:34 -0600, Michael Fuhr <[EMAIL PROTECTED]> wrote: > Add some RAISE INFO statements to print variables' values at key > places. I wonder if one of your SUMs is returning NULL, causing > your addition to evaluate to NULL. If so, then perhaps you should > use COALESCE to tu

Re: [GENERAL] Complex Update Queries with Fromlist

2004-10-16 Thread Mark Dexter
Thank you. That works for the simple example I had. However, I have an additional question about this. What if I need to do a LEFT OUTER JOIN in the Fromlist. For example, this query works but it requires the orders table to appear twice. UPDATE orders set requireddate = (case when c.city in

Re: [GENERAL] Avoiding sequential scans with OR join condition

2004-10-16 Thread Tom Lane
Mike Mascari <[EMAIL PROTECTED]> writes: > SELECT big_table.* > FROM little_table, big_table > WHERE little_table.x = 10 AND > little_table.y IN (big_table.y1, big_table.y2); > Is there any way to write the first query such that indexes will be used? I'm afraid you're stuck with the UNION workaro

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Michael Fuhr
On Sat, Oct 16, 2004 at 09:30:32AM -0500, Josh Close wrote: > On Sat, 16 Oct 2004 00:59:34 -0600, Michael Fuhr <[EMAIL PROTECTED]> wrote: > > > > Add some RAISE INFO statements to print variables' values at key > > places. I wonder if one of your SUMs is returning NULL, causing > > your addition t

Re: [GENERAL] pgsql cvs

2004-10-16 Thread Marc G. Fournier
On Sat, 16 Oct 2004, snpe wrote: Devrim, I update cvs in last two years with cd /u1/pgsql cvs up -dPC I see this error today and I delete all and checkout again It is fine now; pgsql guys destroy cvs often k, you haven't had to do a checkout in last two years, but we destroy CVS often? there see

[GENERAL] Newbie table definition question

2004-10-16 Thread Ken Tozier
I'm a C/Objective C programmer and am having a bit of difficulty figuring out how to define SQL table approximations to things that are very easy to do in C/Objective C Basically what I'm confused about is how to simulate arrays of structs in Postgres. For example, if I define a C struct like s

Re: [GENERAL] OS X Install

2004-10-16 Thread Monte Milanuk
I'm kind of at the same point: I d/I'd the postgreSQL package from entropy.ch, and it apparently installed OK. As mentioned, there already was a postgres user in NetInfo (Panther on an eMac). Tried just changing the password, home directory, and shell to valid values instead of '*' and '/dev

Re: [GENERAL] Change query priority

2004-10-16 Thread Gaetano Mendola
Barry S wrote: Thats fine, but you do understand that nice (linux) will have *no* effect on I/O? I do. For any non-trivial table (that can't be held entirely in memory), re-nice will almost certainly have no effect. That's my feeling too, but at least is a try. Regards Gaetano Mendola --

[GENERAL] pgsql function using C++?, or at least C interfacing with C++ lib?

2004-10-16 Thread Eric Parusel
Hello, I've got a C++ library I need to use, and I want to use it from a pgsql function. Would anyone happen to have any examples of how to accomplish something like this? I see examples of C-based functions for pgsql (like dbsize, etc, in contrib). Which way should I go about this? 1) C based

Re: [GENERAL] pgsql function using C++?, or at least C interfacing with C++ lib?

2004-10-16 Thread Dann Corbit
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Eric Parusel > Sent: Saturday, October 16, 2004 4:12 PM > To: [EMAIL PROTECTED] > Subject: [GENERAL] pgsql function using C++?, or at least C > interfacing with C++ lib? > > > Hello, > > I've

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Josh Close
On Sat, 16 Oct 2004 10:20:35 -0600, Michael Fuhr <[EMAIL PROTECTED]> wrote: > Glad you got it working. > > A question about your design: you appear to have a tblBatchHistory_X > table for each iId value in tblServers. Is there a reason for doing > that instead of having a single tblBatchHistory t

Re: [GENERAL] Newbie table definition question

2004-10-16 Thread Steven Klassen
* Ken Tozier <[EMAIL PROTECTED]> [2004-10-16 13:50:37 -0400]: > I'm a C/Objective C programmer and am having a bit of difficulty > figuring out how to define SQL table approximations to things that > are very easy to do in C/Objective C I sympathize; no matter how many languages you know, there's

Re: [GENERAL] pgsql cvs

2004-10-16 Thread snpe
On Saturday 16 October 2004 04:48 pm, Marc G. Fournier wrote: > On Sat, 16 Oct 2004, snpe wrote: > > > Devrim, > > I update cvs in last two years with > > cd /u1/pgsql > > cvs up -dPC > > > > I see this error today and I delete all and checkout again > > It is fine now; pgsql guys destroy cvs oft

Re: [GENERAL] Newbie table definition question

2004-10-16 Thread Steven Klassen
* Steven Klassen <[EMAIL PROTECTED]> [2004-10-16 17:42:17 -0700]: > INSERT INTO grocery_items (grocery_types_id, name, price) VALUES (1, 'Apple', > '0.50'); > INSERT INTO grocery_items (grocery_types_id, name, price) VALUES (1, 'Orange', > '0.75'); > > INSERT INTO grocery_items (grocery_types_i

Re: [GENERAL] pgsql cvs

2004-10-16 Thread Alvaro Herrera
On Sun, Oct 17, 2004 at 02:48:31AM +, snpe wrote: > On Saturday 16 October 2004 04:48 pm, Marc G. Fournier wrote: > > k, you haven't had to do a checkout in last two years, but we destroy CVS > > often? there seems some bad logic there somewhere ... no? > > > before two years, maybe, but it

Re: [GENERAL] Newbie table definition question

2004-10-16 Thread Ken Tozier
Stephen, Thanks that does help. Syntax is a bit foreign still. I'm not sure why you defined the "grocery_items_id_exists" and "grocery_types_id_exists " constraints though. Is that something that's ever explicitly accessed either through a query or an insert? Or is it one of those things that e

[GENERAL] dealing with invalid date

2004-10-16 Thread Mage
Hi, can pgsql acceppt invalid date values? Sometimes it would be nice to convert 2003-02-29 to 2003-03-01 or to 2003-02-28 automatically instead of throwing back an error message. Mage ---(end of broadcast)--- TIP 6: Have you searche

Re: [GENERAL] Newbie table definition question

2004-10-16 Thread Steven Klassen
* Ken Tozier <[EMAIL PROTECTED]> [2004-10-16 22:52:10 -0400]: > Or is it one of those things that enforces data integrity behind the > scenes? That's exactly it -- one of the most attractive things about the database is that if constraints are defined appropriately it can defend itself from the p

Re: [GENERAL] dealing with invalid date

2004-10-16 Thread Doug McNaught
Mage <[EMAIL PROTECTED]> writes: > Hi, > > can pgsql acceppt invalid date values? Sometimes it would be nice to > convert 2003-02-29 to 2003-03-01 or to 2003-02-28 automatically > instead of throwing back an error message. If you want MySQL, you know where to find it. -Doug -- Let us

Re: [GENERAL] dealing with invalid date

2004-10-16 Thread Mike Nolan
> can pgsql acceppt invalid date values? Sometimes it would be nice to > convert 2003-02-29 to 2003-03-01 or to 2003-02-28 automatically instead > of throwing back an error message. I guess the question is 'accept from where?' This isn't a database question as much as it is a data INPUT questio

Re: [GENERAL] pgsql function using C++?, or at least C interfacing with C++ lib?

2004-10-16 Thread Tom Lane
"Dann Corbit" <[EMAIL PROTECTED]> writes: >> I've got a C++ library I need to use, and I want to use >> it from a pgsql function. > If you want to do this, publish an interface in your C++ library with > the interface functions declared as extern "C" Note that the backend does not incorporate an

Re: [GENERAL] dealing with invalid date

2004-10-16 Thread Scott Marlowe
On Sat, 2004-10-16 at 21:03, Mage wrote: > Hi, > > can pgsql acceppt invalid date values? Sometimes it would be nice to > convert 2003-02-29 to 2003-03-01 or to 2003-02-28 automatically instead > of throwing back an error message. If you're using a language with a date / time lib that

Re: [GENERAL] Tsearch2 trigger firing...

2004-10-16 Thread Net Virtual Mailing Lists
Hello, Thank you to Oleg for your help with this earlier! It resolved it very nicely! I still have one remaining issue which I can't figure out, perhaps best explained with an example: CREATE TABLE sometable ( titleTEXT, body TEXT, footer TEXT, all_fti TSVECTOR ); UPDATE sometable

Re: [GENERAL] Newbie table definition question

2004-10-16 Thread Ken Tozier
You can track whatever information you need about the particular trip, add rows to the cart associating the trip with the items being purchased, and finally the grocery types and items. CREATE TABLE trips ( id bigserial primary key NOT NULL, created timestamp default now() NOT NULL ); CREAT

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Greg Stark
Josh Close <[EMAIL PROTECTED]> writes: > I didn't write it, but it's to avoid locking. Each table is for a > different server. They are all writing at the same time, and I guess > it speeds up the inserts to have them in different tables. Uh, not in Postgres. Perhaps you're thinking of another d

Re: [GENERAL] Tsearch2 trigger firing...

2004-10-16 Thread Oleg Bartunov
On Sat, 16 Oct 2004, Net Virtual Mailing Lists wrote: Hello, Thank you to Oleg for your help with this earlier! It resolved it very nicely! I still have one remaining issue which I can't figure out, perhaps best explained with an example: CREATE TABLE sometable ( titleTEXT, body TEXT, foot

Re: [GENERAL] Avoiding sequential scans with OR join condition

2004-10-16 Thread Sim Zacks
I would use 2 left joins and use the where condition to make sure one of them is true, such as: select big_table.* from big_table left join little_table as l1 on big_table.y1=l1.y and l1.x=10 left join little_table as l2 on big_table.y2=l2.y and l1.x=10 where l1.p_key is not null and l2.p_key is n

Re: [GENERAL] Networking feature for postgresql...

2004-10-16 Thread Katsaros Kwn/nos
Hi again, Having taken a look at the dblink code I have some questions: Having a user defined function, is it possible -with no serious memory overheads- to fork it (outside SPI calls code) in order to make concurrent dblink calls? What I'm thinking of doing is to create a function which opens an

Re: [HACKERS] [GENERAL] Networking feature for postgresql...

2004-10-16 Thread Joe Conway
Katsaros Kwn/nos wrote: > Having taken a look at the dblink code I have some questions: ISTM that you might start with dblink_record() and modify it to suit using SPI and asynchronous libpq calls. See: http://www.postgresql.org/docs/current/static/libpq-async.html Joe --