[GENERAL] Interpolation of environment variables in SQL at runtime?

2004-10-30 Thread Andy Gimblett
Hi all, Question: is there any way to use environment variables (or something similar) in my saved SQL code, and have them expanded at runtime? I can't see a way to do this in the manuals, and a colleague tells me it can't be done, but I wanted to check, because if this _can_ be done it will make

Re: [GENERAL] Reasoning behind process instead of thread based

2004-10-30 Thread Thomas Hallgren
Marco, I mean an entirely event driven server. The trickiest part is to handle N-way. On 1-way, it's quite a clear and well-defined model. You need to clarify this a bit. You say that the scheduler is in user-space, yet there's only one thread per process and one process per CPU. You state that in

[GENERAL] Replicating sequences

2004-10-30 Thread Ed L.
I asked this on the slony list, but maybe more appropriate to ask here... I'm using slony to replicate a database with 200 sequences. To replicate these with slony or our modified dbmirror, the replicator polls every sequence relation (select last_value...) on each syncronization interval. Th

Re: [GENERAL] Reasoning behind process instead of thread based

2004-10-30 Thread Marco Colombo
On Thu, 28 Oct 2004, Thomas Hallgren wrote: Marco Colombo wrote: [processes vs threads stuff deleted] In any modern and reasonable Unix-like OS, there's very little difference between the multi-process or the multi-thread model. _Default_ behaviour is different, e.g. memory is shared by default fo

Re: [GENERAL] Reasoning behind process instead of thread based

2004-10-30 Thread Marco Colombo
On Thu, 28 Oct 2004 [EMAIL PROTECTED] wrote: Marco, Wouldn't locking a process to a CPU cause the CPU to be idle during IO waits and semaphore locks? Even if you didn't lock each DB process to a CPU, IO waits and locks for one session would stop processing on other sessions managed by the same pro

[GENERAL] View's rule on delete problem

2004-10-30 Thread Stanislaw Tristan
CREATE RULE "new_rule2" AS ON DELETE TO "public"."klients_view" DO INSTEAD ( DELETE FROM klients WHERE (klients.klient_id = old.klient_id); DELETE FROM klient_services WHERE (klient_services.klient_id = old.klient_id); ); It's 2 commands, but executing only first. Why? Stanislaw Tristan Kyiv

Re: [GENERAL] Issue adding foreign key

2004-10-30 Thread Edmund Bacon
[EMAIL PROTECTED] ("George Woodring") writes: > I have 2 existing tables in my db: > > iss=> \d pollgrpinfo > Table "public.pollgrpinfo" > Column | Type | Modifiers > ---++--- > pollgrpinfoid | integer

[GENERAL] Foreign Key Non-Null Problem in 8.0

2004-10-30 Thread Jon Uhal
I'm having trouble trying to get my databases setup so that when I delete a row from the base table, all related information is removed as well.  I've been testing this with PostgreSQL version (postmaster (PostgreSQL) 8.0.0beta1) on a Windows 2000 Pro machine.  I have been unsuccessful in tr

Re: [GENERAL] list fieldnames in table? (from PHP)

2004-10-30 Thread GreyGeek
Miles Keaton wrote: > Is there a simple way to list fieldnames in a table, from PHP? > > When on the command-line, I just do \d tablename > > But how to get the fieldnames from PHP commands? > > ---(end of broadcast)--- > TIP 3: if posting/reading

[GENERAL] subselect, order by and left join

2004-10-30 Thread Morten K. Poulsen
Dear list, Please let me know if this is not the list to ask this kind of question. I am trying to optimize a query that joins two relatively large (75 rows in each) tables. If I do it using a subselect, I can "force" the planner to choose the fastest path. Now, my question is: If I have a s

Re: [GENERAL] Bug or stupidity

2004-10-30 Thread Thomas Hallgren
Martijn, I realize that the change I'm proposing might be too complex to be added in the upcoming 8.0 release. I do find this discussion interesting though, so please bear with me while I try to tie up some loose ends. UPDATE [ ONLY ] table SET col = expression [, ...] [ FROM fromlist ] [

Re: [GENERAL] Superuser log-in through a web interface?

2004-10-30 Thread Kevin Barnard
You have a conceptual error. When connecting you are connecting "to a database". With out the database you are not connecting to anything hence the failure. Typically to do what you are trying to do you would connect to the database template1 unless a database is specified. If you have another

Re: [GENERAL] Bug or stupidity

2004-10-30 Thread Thomas Hallgren
Martijn van Oosterhout wrote: Sure, that's what you could do, but it makes the query rather more complex than it needs to be. Do you consider this overly complex? Compare: DELETE FROM x WHERE EXISTS (SELECT * FROM table WHERE x.a = table.a and x.b > table.b and table.c = 4) to: DELETE FROM x,

[GENERAL] field incrementing in a PL/pgSQL trigger

2004-10-30 Thread Tim Vadnais
Title: field incrementing in a PL/pgSQL trigger Hi, My boss wants to add some logging functionality to some of our tables on update/delete/insert.  I need to log who, when, table_name, field name, original value and new value for each record, but only logging modified fields, and he wants m

Re: [GENERAL] Duplicating a database

2004-10-30 Thread Karim Nassar
OK. I am lost now. Introduction: * postgres 7.4.5, Gentoo Background: * Server and laptop have identical configurations in every regard (excepting that all software is built for their respective processor types). * the database is named 'orfs' * I want a copy of it on my laptop. * This t

[GENERAL] Arrays and constraints

2004-10-30 Thread Daniel Savard
I would like to know if there is a way to define a constraint for the values of an array type? For example, if I define a table where column A is an integer[] and each value must be an index to an element in another table. How can I do this without the help of a third table holding relations betwe

Re: [GENERAL] Question about ltree....

2004-10-30 Thread Oleg Bartunov
Greg, I don't understand your idea ! Why do you need three Ltrees ? Oleg On Tue, 26 Oct 2004, Greg Saylor wrote: Hello, First let me thank Mike for his earlier suggestion that I consider using ltree - it really is working very nicely!... I do have a question about performance/design though... I

[GENERAL] Superuser log-in through a web interface?

2004-10-30 Thread Ken Tozier
Hello all, I'm trying to create a php form for logging in to postgress with different level passwords and my first test with a superuser isn't working unless I specify a database name. I would like to allow superusers to log in without specifying a database so they can create new users, databas

Re: [GENERAL] having clause question

2004-10-30 Thread Tom Lane
Ian Barwick <[EMAIL PROTECTED]> writes: > On Sat, 30 Oct 2004 15:17:16 -0700, Shane Wegner > <[EMAIL PROTECTED]> wrote: >> Under MySQL, this query does the trick. >> select lastname,count(*) as c from names group by lastname >> having c > 1; >> >> Is it possible to do a query like this with Postgr

Re: [GENERAL] having clause question

2004-10-30 Thread Ian Barwick
On Sat, 30 Oct 2004 15:17:16 -0700, Shane Wegner <[EMAIL PROTECTED]> wrote: > Hello, (...) > I want to retrieve any last names with more than 1 > occurence in the table. Under MySQL, this query does the > trick. > select lastname,count(*) as c from names group by lastname > having c > 1; > > But

Re: [GENERAL] counting records of schema

2004-10-30 Thread Ian Barwick
On Tue, 26 Oct 2004 08:03:26 +0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I need to know how many records are in a specific schema of a database. > > I've tried with a function but there are still problems Providing details of the problems usually helps ;-). > Can you give me some

Re: [GENERAL] pg8 beta3 Win32: after dropping db directory is not removed

2004-10-30 Thread Magnus Hagander
>Hi, > >Most (but not all) of the time when I drop a database I receive the >following warning: > >WARNING: could not remove database directory "c:/program >files/PostgreSQL/8.0.0-beta3-dev1/data/base/X" > >Where X is the directory name of for the database being >dropped. It's >not a re

Re: [GENERAL] The reasoning behind having several features outside

2004-10-30 Thread Alvaro Herrera
On Sat, Oct 30, 2004 at 04:39:42PM -0300, Marc G. Fournier wrote: > On Sat, 30 Oct 2004, Joshua D. Drake wrote: > > >No, not really. Because items such as plPerl don't require > >changes to the backend. Replication requires changes to the backend. > > Replication doesn't require changes to the ba

Re: [GENERAL] The reasoning behind having several features outside

2004-10-30 Thread Tom Lane
"Marc G. Fournier" <[EMAIL PROTECTED]> writes: > On Sat, 30 Oct 2004 [EMAIL PROTECTED] wrote: >> Replication is one subsystem not included in source tree. But PostgreSQL >> has other subsystems that are included such as plugins for procedural >> languages. So isn't the same risks involved with them

Re: [GENERAL] The reasoning behind having several features outside

2004-10-30 Thread Jan Wieck
On 10/30/2004 3:39 PM, Marc G. Fournier wrote: On Sat, 30 Oct 2004, Joshua D. Drake wrote: Replication is one subsystem not included in source tree. But PostgreSQL has other subsystems that are included such as plugins for procedural languages. So isn't the same risks involved with them? No, not r

Re: [GENERAL] ON DELETE trigger blocks delete from my table

2004-10-30 Thread Edmund Bacon
[EMAIL PROTECTED] ("Naeem Bari") writes: > I understand. Makes sense. Is there anyway for my trigger function to > "know" that it is being called on a delete or on an update? Because I do > need to "return new" on update... and I really don't want to write 2 > different functions, one for update a

[GENERAL] pg8 beta3 Win32: after dropping db directory is not removed

2004-10-30 Thread Peter Lang
Hi, Most (but not all) of the time when I drop a database I receive the following warning: WARNING: could not remove database directory "c:/program files/PostgreSQL/8.0.0-beta3-dev1/data/base/X" Where X is the directory name of for the database being dropped. It's not a really big dea

[GENERAL] counting records of schema

2004-10-30 Thread Tom.Zschockelt
hi, I need to know how many records are in a specific schema of a database. I've tried with a function but there are still problems Can you give me some hints : -- Function: count_records(myschema varchar) -- DROP FUNCTION count_records("varchar"); CREATE OR REPLACE FUNCTION count_records("

Re: [GENERAL] Any plans on allowing user-defined triggers to

2004-10-30 Thread Valentin Militaru
Well, I guess the only moments when you can verify those conditions are when you insert or delete  a project, because it seems logical to me that, at the moment of a department insertion, you will not have any projects related to it, so the constraint you need will automatically be broken. So,

[GENERAL] Question about ltree....

2004-10-30 Thread Greg Saylor
Hello, First let me thank Mike for his earlier suggestion that I consider using ltree - it really is working very nicely!... I do have a question about performance/design though... I have a table like this: CREATE TABLE sometable ( id SERIAL, category0 LTREE, category1 LTR

Re: [GENERAL] Restore problem

2004-10-30 Thread Mousa.Shaya
I forgot to add that I used the command for restore: psql –f   Thanks Mousa   From: Shaya Mousa (Nokia-ES/Boston) Sent: Tuesday, October 26, 2004 11:42 AM To: '[EMAIL PROTECTED]' Subject: Restore problem   I have created a backup file using pg_dumpall. When I try to r

[GENERAL] Kill a postgres session

2004-10-30 Thread HM
Hello ! To kill a session i used KILL -INT . This command wasn't successfull. The processus is still here when an 'ps ax' or a 'select * from pg_stat_activity' Is there an other way to kill this process only because a web server 24/7 use postgres and cannot stop postgresql now. Thanks ! HM PS

Re: [GENERAL] Any plans on allowing user-defined triggers to be

2004-10-30 Thread Valentin Militaru
You can do that. But first you have to do some optimisations, like:     add a column id(bigserial) to the departamens table, after which you will replace the column department with id_department in the projects table. It is an optimisation, as you are dealing with integer, not text.     After

[GENERAL] ms access app ?

2004-10-30 Thread Tom.Zschockelt
Hi, we have a large ms-access application (as .mde file) which is connected to an oracle database. Now we want to migrate to postgresql. Database migration has been done successfully but when starting the access-application we get the following error: "Cannot find table ... on database" I manu

Re: [GENERAL] The reasoning behind having several features outside

2004-10-30 Thread Marc G. Fournier
On Sat, 30 Oct 2004, Joshua D. Drake wrote: Replication is one subsystem not included in source tree. But PostgreSQL has other subsystems that are included such as plugins for procedural languages. So isn't the same risks involved with them? No, not really. Because items such as plPerl don't requi

Re: [GENERAL] The reasoning behind having several features outside

2004-10-30 Thread Joshua D. Drake
Replication is one subsystem not included in source tree. But PostgreSQL has other subsystems that are included such as plugins for procedural languages. So isn't the same risks involved with them? No, not really. Because items such as plPerl don't require changes to the backend. Replication re

Re: [GENERAL] The reasoning behind having several features outside

2004-10-30 Thread Marc G. Fournier
On Sat, 30 Oct 2004 [EMAIL PROTECTED] wrote: Jeff Davis wrote: Other people have answered, but I'd like to add: It makes it much faster to fix bugs and improve features in the projects outside of the source tree. If replication has a bug, you don't want to wait for the next point release, you want

Re: [GENERAL] The reasoning behind having several features outside

2004-10-30 Thread nd02tsk
Jeff Davis wrote: > Other people have answered, but I'd like to add: > > It makes it much faster to fix bugs and improve features in the projects > outside of the source tree. If replication has a bug, you don't want to > wait for the next point release, you want a fix *now*. PostgreSQL is a > big

Re: [GENERAL] can't shrink relation

2004-10-30 Thread Tom Lane
"Ed L." <[EMAIL PROTECTED]> writes: > What does this mean? > WARNING: Rel pg_class: TID 17/13: InsertTransactionInProgress 106004881 - > can't shrink relation It's harmless. In 7.4 it's been downgraded to a NOTICE, and I wonder if we shouldn't push it lower yet. regards

Re: [GENERAL] QMail

2004-10-30 Thread Tino Wildenhain
Hi, Am Sa, den 30.10.2004 schrieb Joshua D. Drake um 18:25: > >Do you know anything else? dbmail seems too much mysql > >centric while at least providing access to postgresql > >which is a pro. The storage of mails in big chunks > >seems less then ideal and you need clever views to > >get local p

Re: [GENERAL] QMail

2004-10-30 Thread Robby Russell
On Wed, 2004-10-27 at 14:14 -0400, Eric wrote: > Is there something to interface postgreSQL with QMail to store mails in > pgsql instead of using mbox or maildir? > > Or maybe it's not a good idea to do that? > > I think there is some adavantages... We use QMail for our vhosting and it works qui

Re: [GENERAL] QMail

2004-10-30 Thread Joshua D. Drake
Do you know anything else? dbmail seems too much mysql centric while at least providing access to postgresql which is a pro. The storage of mails in big chunks seems less then ideal and you need clever views to get local part and host seperately. Hello, We were able to put something together f

Re: [GENERAL] QMail

2004-10-30 Thread Tino Wildenhain
Hi, Am Sa, den 30.10.2004 schrieb Russell Smith um 8:02: > On Thu, 28 Oct 2004 04:14 am, Eric wrote: > > Is there something to interface postgreSQL with QMail to store mails in > > pgsql instead of using mbox or maildir? > > > > Or maybe it's not a good idea to do that? > > > > I think there is

Re: [GENERAL] UTF-8 -> ISO8859-1 conversion problem

2004-10-30 Thread Cott Lang
Thanks for the detailed reply, you've confirmed what I suspected. :) I guess I have some work to do! On Fri, 2004-10-29 at 10:19, J. Michael Crawford wrote: >In my experience, there are just some characters that don't want to be > converted, even if they appear to be part of the normal 8-bi

Re: [GENERAL] 8.0 Beta 4 denying network connections?

2004-10-30 Thread Vinko Vrsalovic
On Fri, Oct 29, 2004 at 09:59:17PM -0400, Tom Lane wrote: > Vinko Vrsalovic <[EMAIL PROTECTED]> writes: > > [EMAIL PROTECTED] sources 20:55:07]$ telnet mymachine 5431 > > Trying 192.168.0.169... > > telnet: Unable to connect to remote host: Connection refused > > Looks to me like you forgot to ena