Re: [GENERAL] Happiness is a cross database link...

2005-01-05 Thread Darren Houston
Hello Alex, DBLink is located in the PostgreSQL source under $POSTGRES_SOURCE/contrib/dblink Just do a make and make install (assuming you installed PostgreSQL from source). The docs are also located in the same directory. You have to execute dblink.sql against your database to implement the func

Re: [GENERAL] Happiness is a cross database link...

2005-01-05 Thread Alex Turner
Looks like a great idea, but alas I cannot actualy find any files.. CVS is empy, FTP is unaccesible, home page goes nowhere, no messages in forums.. Some more clues to the enigmatic whereabouts of this project would be appreciated if you have them. Google even suggests I try dblink postgresql inst

Re: [GENERAL] Happiness is a cross database link...

2005-01-05 Thread Marc G. Fournier
Check out dbi-link ... not sure how far into what you are looking for it is, but from David's description to me today, it sounds like it makes things transparent to the end user (ie. the 'links' look like extra schema's within your database) ... haven't played with it yet, just going by David's

[GENERAL] Happiness is a cross database link...

2005-01-05 Thread Alex Turner
I am trying to find out some information on how to set up a cross database links so that I can have queries and foreign keys that cross a physical database. This is not just a technical requirement, but a legal one (The client requires that we do not co-mingle data). I have a new database that ha

Re: [GENERAL] Trigger Question

2005-01-05 Thread Michael Fuhr
On Wed, Jan 05, 2005 at 05:35:18PM -0500, Terry Lee Tucker wrote: > On Wednesday 05 January 2005 05:09 pm, Alex Turner saith: > > > > Maybe what you want is a stored procedure, not a trigger. > > Now why didn't I think of that? That's exactly what I need to do. This is a good example of why it's b

Re: [GENERAL] PostgreSQL users on webhosting

2005-01-05 Thread Robby Russell
On Wed, 2005-01-05 at 12:34 -0800, Jeff Davis wrote: > Benefits of multiple instances: > (1) Let's say you're using the one-instance method and one of your web > users is a less-than-talented developer, and makes an infinite loop that > fills the database with garbage. Not only will that hurt perfo

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] SELECT WHERE NOT, is not working

2005-01-05 Thread Steve Crawford
On Wednesday 05 January 2005 2:51 pm, [EMAIL PROTECTED] wrote: > Thanks, Ragnar, > > You are right in what is happening. The code was supposed to be > sending '' but it is sending NULL instead. I see now -- in > PostgreSQL to look for any record without the 'X' I have to use a > combined condition

Re: [GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread MargaretGillon
Thanks, Ragnar, You are right in what is happening. The code was supposed to be sending '' but it is sending NULL instead. I see now -- in PostgreSQL to look for any record without the 'X' I have to use a combined condition because a NULL is not included in a != statement. select count(*) from re

Re: [GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread Ragnar Hafstað
On Wed, 2005-01-05 at 22:32 +, Ragnar Hafstað wrote: > select count(*) from resource where reengine is NULL 'X'; typo. I meant of course: select count(*) from resource where reengine is NULL; gnari ---(end of broadcast)--- TIP 5: Have you

Re: [GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread Tom Lane
[EMAIL PROTECTED] writes: > I have a small table in which I have a Character(1) field called reengine. > The field either has an "X" or is empty. This field does not have NULL > values. There are 27 records in the table, 25 are marked with an 'X' in > reengine. > When I write > select count(*) fro

Re: [GENERAL] Trigger Question

2005-01-05 Thread Terry Lee Tucker
Now why didn't I think of that? That's exactly what I need to do. Thanks to all who responded ;o) On Wednesday 05 January 2005 05:09 pm, Alex Turner saith: > Maybe what you want is a stored procedure, not a trigger. A trigger > will only have the data that is available from the insert operation,

Re: [GENERAL] Index on a view??

2005-01-05 Thread Ragnar Hafstað
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 functionality > > that can i

Re: [GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread Ragnar Hafstað
On Wed, 2005-01-05 at 13:51 -0800, [EMAIL PROTECTED] wrote: > I have a small table in which I have a Character(1) field called reengine. > The field either has an "X" or is empty. This field does not have NULL > values. There are 27 records in the table, 25 are marked with an 'X' in > reengine. >

Re: [GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread Alex Turner
Try: select count(*) from resource where reengine <> 'X'; Alex Turner NetEconomist On Wed, 5 Jan 2005 13:51:58 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a small table in which I have a Character(1) field called reengine. > The field either has an "X" or is empty. This field

Re: [GENERAL] Trigger Question

2005-01-05 Thread Thomas Braad Toft
Terry Lee Tucker wrote: 1) INSERT INTO logs (carr_code, ..., ..., ...) VALUES('ABCDEFG', ..., ...); logs is table A in my question 2) logs_insert fires (This is a AFTER INSERT trigger) 3) in this trigger, I need to do the following: update avlds set carr_code = new.carr_code where avlds

Re: [GENERAL] Trigger Question

2005-01-05 Thread Alex Turner
Maybe what you want is a stored procedure, not a trigger. A trigger will only have the data that is available from the insert operation, and the rest of the row that was modified (It really can't have anything else if you think about it) Stored procedures are an exellent way to guarantee atomic a

[GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread MargaretGillon
I have a small table in which I have a Character(1) field called reengine. The field either has an "X" or is empty. This field does not have NULL values. There are 27 records in the table, 25 are marked with an 'X' in reengine. I am querying the table from pgadmin v1.1.0 for windows. When I write

Re: [GENERAL] Trigger Question

2005-01-05 Thread Terry Lee Tucker
1) INSERT INTO logs (carr_code, ..., ..., ...) VALUES('ABCDEFG', ..., ...); logs is table A in my question 2) logs_insert fires (This is a AFTER INSERT trigger) 3) in this trigger, I need to do the following: update avlds set carr_code = new.carr_code where avlds.recid = ??;

Re: [GENERAL] Index on a view??

2005-01-05 Thread Joshua D. Drake
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 functionality that can implement them. Can you tell me what you mean by that? You

Re: [GENERAL] Trigger Question

2005-01-05 Thread Michael Fuhr
On Wed, Jan 05, 2005 at 03:25:08PM -0500, Terry Lee Tucker wrote: > When I assign a value to a certain column in a table A, I want to be able to > assign a value in table A to table B and then to assign a value in table B to > table C. What do you mean by "assign a value to a certain column"?

Re: [GENERAL] PostgreSQL users on webhosting

2005-01-05 Thread Mark
how about to have only one DB with multiple DB shcemas and assign a DB user per schema? Will this solution use the multiple CPUs ? - I think it should this is my 2cents. --- Jeff Davis <[EMAIL PROTECTED]> wrote: > Benefits of multiple instances: > (1) Let's say you're using the one-instance

Re: [GENERAL] Index on a view??

2005-01-05 Thread Jeff Davis
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 functionality > that can implement them. > Can you tell me what you mean by that? Regards,

Re: [GENERAL] PostgreSQL users on webhosting

2005-01-05 Thread Jeff Davis
On Wed, 2005-01-05 at 13:52 -0500, Jeff wrote: [snip] > You'd have to have separate shared buffers for each which would eat > away from the filesystem cache. Not to mention overhead of having > many more PG's running (in terms of just processes htat need to be > managed and memory used by each

Re: [GENERAL] PostgreSQL users on webhosting

2005-01-05 Thread Jeff Davis
Benefits of multiple instances: (1) Let's say you're using the one-instance method and one of your web users is a less-than-talented developer, and makes an infinite loop that fills the database with garbage. Not only will that hurt performance, but if it fills the disk than no other users can even

Re: [GENERAL] Trigger Question

2005-01-05 Thread Terry Lee Tucker
When I assign a value to a certain column in a table A, I want to be able to assign a value in table A to table B and then to assign a value in table B to table C. I was wanting to do this from the trigger level in an AFTER UPDATE trigger to ensure it gets done. I would like to be able to pass t

Re: [GENERAL] Trigger Question

2005-01-05 Thread Michael Fuhr
On Wed, Jan 05, 2005 at 02:56:27PM -0500, Terry Lee Tucker wrote: > > Is there any way to pass dynamic data into a trigger function? I think the > answer is no, but just in case... What do you mean by "dynamic data"? What problem are you trying to solve? -- Michael Fuhr http://www.fuhr.org/~mf

Re: [GENERAL] Index on a view??

2005-01-05 Thread Michael Fuhr
On Wed, Jan 05, 2005 at 08:15:28PM +0100, Joost Kraaijeveld wrote: > > Is it possible to create an index on a view? Querying a view should use indexes if the underlying tables have indexes and the planner can figure out how to use them. For complex queries you might need to use a materialized vie

[GENERAL] Trigger Question

2005-01-05 Thread Terry Lee Tucker
Greetings: Is there any way to pass dynamic data into a trigger function? I think the answer is no, but just in case... TIA -- Work: 1-336-372-6812 Cell: 1-336-363-4719 email: [EMAIL PROTECTED] ---(end of broadcast)--- TIP 9: the planner will i

Re: [GENERAL] Index on a view??

2005-01-05 Thread Jeff Davis
No, you can only create an index on the underlying tables. A view is a virtual realtion, not a physical one, so what would the index point to? Any functionality you need you should be able to get with functional indexes. Perhaps if/when postgresql gets materialized views an index on a view might

Re: [GENERAL] warning: pg_query(): Query failed

2005-01-05 Thread Aaron Steele
hi steven, here's another file where the actual SQL query (the one in the error message) is defined. it's in the forum_get_forums() function. bruno noticed that the IF (via pl/pgsql) might not like the boolean casting to "2" since 7.4 is more strict about casting? does this help? /** * @file

Re: [GENERAL] warning: pg_query(): Query failed

2005-01-05 Thread Aaron Steele
hi bruno, would it be useful to see the IF PLSQL function, or would you recommend a modification to the database.pgsql.inc file? On Jan 5, 2005, at 10:52 AM, Bruno Wolff III wrote: On Wed, Jan 05, 2005 at 10:17:39 -0800, Aaron Steele <[EMAIL PROTECTED]> wrote: hi, warning: pg_query(): Query fai

[GENERAL] Index on a view??

2005-01-05 Thread Joost Kraaijeveld
Hi all, Is it possible to create an index on a view? Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] web: www.askesis.nl ---(end of broadcast)---

Re: [GENERAL] PostgreSQL users on webhosting

2005-01-05 Thread Jeff
On Jan 5, 2005, at 9:49 AM, Alan Garrison wrote: Out of curiosity, what kind of performance hit (whether CPU, memory, disk activity) is incurred with having a lot of postmasters running in this kind of a setup versus one postmaster with lots of databases? We typically run one postmaster for a l

Re: [GENERAL] multi column index and order by

2005-01-05 Thread Stephan Szabo
On Wed, 5 Jan 2005, Mage wrote: > "order by a asc b desc" > > how can I create an index for this? You need to create an operator class for reversed comparison of whatever type b is and then use it on b in the index definition. Something like (however, you should really use a C function for the

Re: [GENERAL] warning: pg_query(): Query failed

2005-01-05 Thread Bruno Wolff III
On Wed, Jan 05, 2005 at 10:17:39 -0800, Aaron Steele <[EMAIL PROTECTED]> wrote: > hi, > > warning: pg_query(): Query failed: ERROR: invalid input syntax for type > boolean: "2" > CONTEXT: PL/pgSQL function "if" line 2 at if in > /Library/WebServer/Documents/dmap/includes/database.pgsql.inc on

Re: [GENERAL] problem finding the 8.0.3RC download

2005-01-05 Thread Magnus Hagander
The MSI installer for RC3 is not yet ready. We expect it to go out in the next couple of days.   //Magnus From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John DoggettSent: Wednesday, January 05, 2005 6:13 PMTo: pgsql-general@postgresql.orgSubject: [GENERAL] prob

Re: [GENERAL] multi column index and order by

2005-01-05 Thread Bruno Wolff III
On Wed, Jan 05, 2005 at 15:35:22 +0100, Mage <[EMAIL PROTECTED]> wrote: > Hello, > > "order by a asc b desc" > > how can I create an index for this? Currently you can't directly. In recent versions of Postgres you have some options: If one of the types has a normal minus operator, then

Re: [GENERAL] warning: pg_query(): Query failed

2005-01-05 Thread Steven Klassen
# i'm setting up a forum that's connected to postgresql 7.4.2 (via # drupal.org framework) and i'm getting some errors. here's the link, # followed by the errors verbatim: http://128.32.146.140/dmap/?q=forum We would have to see database.pgsql.inc to tell you what's wrong with it. -- Steven Klas

Re: [GENERAL] varchar vs text

2005-01-05 Thread Martijn van Oosterhout
On Tue, Jan 04, 2005 at 09:50:18AM +0200, Sim Zacks wrote: > Are there any differences between text and varchar? I found the following in > the docs, which leads me to believe that there are no differences at all. > Can someone please confirm this before I switch all my varchars to text? Correct.

[GENERAL] warning: pg_query(): Query failed

2005-01-05 Thread Aaron Steele
hi, i'm setting up a forum that's connected to postgresql 7.4.2 (via drupal.org framework) and i'm getting some errors. here's the link, followed by the errors verbatim: http://128.32.146.140/dmap/?q=forum warning: pg_query(): Query failed: ERROR: invalid input syntax for type boolean: "2" CONT

Re: [GENERAL] problem finding the 8.0.3RC download

2005-01-05 Thread Frank D. Engel, Jr.
Wow, 8.0 isn't even out yet and you're looking for 8.0.3? I think you misread something somewhere. You are probably looking for 8.0rc3 (quite different from 8.0.3), which is the 3rd "release candidate" for 8.0. An rc3 installer does not seem to be available yet; there is an rc2 installer, howeve

[GENERAL] problem finding the 8.0.3RC download

2005-01-05 Thread John Doggett
hello everyone!   I'm new to PostgresSQL and I am having trouble finding the 8.0.3RC. (for windows). I have tried teh FTP mirrors but the directory listings on those mirrors do not contain a folder for version 8.0.3. Many subfolders require a UID PWD, which I don't have.   The bittorrent d

Re: [GENERAL] Passing a ROWTYPE to a function

2005-01-05 Thread Michael Fuhr
On Wed, Jan 05, 2005 at 05:04:03AM -0800, Eric Brown wrote: > I'm trying to write a function that takes a %ROWTYPE as an argument. The code you posted works in 8.0. Here's an item from the 8.0 Release Notes: * More support for composite types (row and record variables) in PL/pgSQL For examp

Re: [GENERAL] hundreds of millions row dBs

2005-01-05 Thread Wes
> Out of curiosity, what value of sort_mem were you using? > > (In PG 8.0, the sort memory setting used by CREATE INDEX will be > maintenance_work_mem not work_mem, which should help in getting larger > values to be used. But in existing releases you usually need to think > about a manual tweak.)

[GENERAL] multi column index and order by

2005-01-05 Thread Mage
Hello, "order by a asc b desc" how can I create an index for this? Mage ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [GENERAL] Passing a ROWTYPE to a function

2005-01-05 Thread Tom Lane
Eric Brown <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE FUNCTION g2(int) RETURNS int LANGUAGE plpgsql AS ' > DECLARE item t1%ROWTYPE; > BEGIN > SELECT INTO item * FROM t1 WHERE x = $1; > RETURN g1(item); > END'; This works in 8.0 but not earlier releases --- there was not support in p

Re: [GENERAL] PostgreSQL users on webhosting

2005-01-05 Thread Alan Garrison
Jeff Davis wrote: However, for truly good seperation, I recommend that you run a seperate instance of postgresql (with a seperate $PGDATA directory) for each user, and run it under the UID of that user. It requires a little more disk space per account, but in a dollar amount it's virtually zero wit

[GENERAL] Passing a ROWTYPE to a function

2005-01-05 Thread Eric Brown
I'm trying to write a function that takes a %ROWTYPE as an argument. I'm just not sure how to call it from another function. This is what I tried: CREATE TABLE t1 (x int, y int); INSERT INTO t1 VALUES (1, 2); CREATE OR REPLACE FUNCTION g1(t1) RETURNS int LANGUAGE plpgsql AS ' BEGIN RETURN $1.y; END

Re: [GENERAL] PostgreSQL users on webhosting

2005-01-05 Thread Jeff Davis
In a typical setup, you might do: Edit pg_hba.conf to allow connections to the database "sameuser" which is a special word meaning that the user can only connect to a database of the same name. Then, for each webhosting account you make (let's say the user is named "foo" with password "bar"), exe