Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Berend Tober
Andrus wrote: "if department _id is NULL, user has access to all departments data." This is your problem. You've assigned meaning to the "value" NULL. CREATE TABLE permission ( id serial, user_id CHAR(10) NOT NULL REFERENCES user, permission_id CHAR(10) NOT NULL REFERENCES privilege, UNIQUE (

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
Joshua D. Drake wrote: > Somebody may know of a better way but what I would think would happen is > this: > > Break up list, insert each value of list into a temp table as a row, > return set of temp table. Ok. I tried this & ran in to some trouble: CREATE OR REPLACE FUNCTION setret(text) RETU

Re: [GENERAL] ERROR: could not open relation

2005-07-15 Thread Thomas F. O'Connell
One final final question: my suspicion is no, but I just want to ask: this would not affect all inherited tables with bgwriter, would it, in scenarios where a persistent inherited table gets dropped while a parent table is being queried? Could this result in a similar scheduling conflict fo

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
Joshua D. Drake wrote: > You would actually have to have a set. What I believe you are trying to > do is transform a list to a result set. I don't think you can do that > without some additional programming within the function. > > Somebody may know of a better way but what I would think would ha

Re: [GENERAL] how to insert '\\' in postgres database using java

2005-07-15 Thread Martijn van Oosterhout
On Fri, Jul 15, 2005 at 04:20:52PM +0200, Ropel wrote: > If, as the name of the column suggests, the backslash is used for > pathnames, why don't you bypass the problem by using normal slash (I.E: > "path/to/my/file")? It works well > with new windows versions and, of course, unix-style pathnames

Re: [GENERAL] Function returning any (tuple) type

2005-07-15 Thread Martijn van Oosterhout
On Fri, Jul 15, 2005 at 04:51:04PM +1000, Ezequiel Tolnay wrote: > Hi, I wonder if anyone can help me find a solution for this problem. I'm > porting a database from MS SQL Server 2000 to PostgreSQL 8.0.1 (Windows). > The main problem I see is that the funcitions in PostgreSQL seem to be > alw

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Scott Marlowe
On Fri, 2005-07-15 at 15:16, [EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote on 07/15/2005 02:49:09 PM: > > > On Fri, Jul 15, 2005 at 20:08:32 +0300, > > Andrus <[EMAIL PROTECTED]> wrote: > > > > > > So I'll think still continuing to use null as unrestricted department > > > access. > > > > >

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Richard_D_Levine
[EMAIL PROTECTED] wrote on 07/15/2005 02:49:09 PM: > On Fri, Jul 15, 2005 at 20:08:32 +0300, > Andrus <[EMAIL PROTECTED]> wrote: > > > > So I'll think still continuing to use null as unrestricted department > > access. > > > > Is it reasonable to create unique constraint using > > > > CREATE U

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Bruno Wolff III
On Fri, Jul 15, 2005 at 20:08:32 +0300, Andrus <[EMAIL PROTECTED]> wrote: > > So I'll think still continuing to use null as unrestricted department > access. > > Is it reasonable to create unique constraint using > > CREATE UNIQUE INDEX user_id_permission_id_department_id_unique_idx > ON pe

Re: [GENERAL] PostgreSQL 8.0.3

2005-07-15 Thread Solange
Yes I have, the SO supports IPV6. I can access my local machine using ::1 and also access the apache web server using IPV6, but I am not able to access the Postgre using a command like psql -h ::1 -d dbteste -u postgres psql -h [fe80::1] -d dbteste -u postgres Of course if I use localhost I a

Re: [GENERAL] Trigger on Update

2005-07-15 Thread sunithab
This works. Thanks for response. - Original Message - From: "mark reid" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Friday, July 15, 2005 11:16 AM Subject: Re: [GENERAL] Trigger on Update Hi, Change it to a "BEFORE UPDATE" trigger, and set NEW.updated_date := now(); Other

Re: [GENERAL] problem after restoring a backup database on a

2005-07-15 Thread Scott Marlowe
Not sure, could you post a cut-n-paste of your session so we can see what you're doing? Sometimes just having someone to "look over your shoulder" makes all the difference in the world. On Fri, 2005-07-15 at 12:41, mail TechEvolution wrote: > Hi Scott > > i don't know, i do just the exact thing,

Re: [GENERAL] Trigger on Update

2005-07-15 Thread Mike Rylander
On 7/15/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: [snip] > > Anybody know what is the syntax I have to use in update statement. > > > > CREATE TRIGGER "trg_update_note_updated_date" AFTER UPDATE > ON "property"."note" FOR EACH ROW > EXECUTE PROCEDURE > "property"."update_not

Re: [GENERAL] Trigger on Update

2005-07-15 Thread Joshua D. Drake
Anybody know what is the syntax I have to use in update statement. Try using now() instead of CURRENT_DATE. CREATE TRIGGER "trg_update_note_updated_date" AFTER UPDATE ON "property"."note" FOR EACH ROW EXECUTE PROCEDURE "property"."update_note_updated_date_trg"(); CREATE OR REPLACE

Re: [GENERAL] Postgres for Fedora Core 2 OS ****************

2005-07-15 Thread Devrim GUNDUZ
Hi, On Fri, 15 Jul 2005, Dianne Yumul wrote: Here: http://www.postgresql.org/ftp/binary/v8.0.3/linux/rpms/fedora/fedora-core-2/ Also, 8.0.2+ RPMs need the following RPM: http://developer.postgresql.org/~devrim/compat-postgresql-libs-3-3PGDG.i686.rpm Regards, -- Devrim GUNDUZ devrim~gunduz

[GENERAL] Trigger on Update

2005-07-15 Thread sunithab
Can anybody help me creating a trigger on update trigger with update statement as below.   This trigger fires after update on a table called note  to update the updated_date field.   But when the table is updated the trigger is firing recursively.   Anybody know what is the syntax I have to

Re: [GENERAL] CVS - psql segfault

2005-07-15 Thread Alvaro Herrera
On Fri, Jul 15, 2005 at 05:30:52PM +, Matt Miller wrote: > However, my problem was solved doing a "make distclean" and then > rebuilding. Does this mean that there is a dependency missing from a > makefile somewhere? Or, as a matter of policy, should I just always > clean after updating? Yo

Re: [GENERAL] problem after restoring a backup database on a different

2005-07-15 Thread mail TechEvolution
Hi Scott i don't know, i do just the exact thing, with exact users and one the other pc (where the db is not original created, + tried on 3 different pc) it is not working. i can restore the database, the tables and data is there, but i cannot use the tables i can connect to the database i

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Andrus
> Then redesign this as a many to many relation. That way someone can > have access to one, two, three, four, or all departments. This means adding separate row for each department into permission table. If new department is added, I must determine in some way users which are allowed access to a

Re: [GENERAL] CVS - psql segfault

2005-07-15 Thread Matt Miller
On Fri, 2005-07-15 at 13:22 -0400, Tom Lane wrote: > Matt Miller <[EMAIL PROTECTED]> writes: > > The CVS version of psql was segfaulting > > What are your locale settings? [EMAIL PROTECTED] ~]$ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLAT

Re: [GENERAL] CVS - psql segfault

2005-07-15 Thread Tom Lane
Matt Miller <[EMAIL PROTECTED]> writes: > The CVS version of psql was segfaulting on exit yesterday, and today's > version segfaults when the program starts. Is this happening to anyone > else? The only work done recently in psql is Bruce's stuff for locale-specific numeric formatting, so I'm bet

Re: [GENERAL] PLPGSQL how to get transaction isolation level info

2005-07-15 Thread Tom Lane
Janning Vygen <[EMAIL PROTECTED]> writes: > How can a function determine in which isolation level it runs? select current_setting('transaction_isolation'); regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Andrus
> "if department _id is NULL, user has access to all departments data." > > This is your problem. You've assigned meaning to the "value" NULL. > > CREATE TABLE permission ( > id serial, > user_id CHAR(10) NOT NULL REFERENCES user, > permission_id CHAR(10) NOT NULL REFERENCES privilege, > UNIQU

Re: [GENERAL] Transparent encryption in PostgreSQL?

2005-07-15 Thread Chris Browne
[EMAIL PROTECTED] ("Matt McNeil") writes: > Greetings,I need to securely store lots of sensitive contact > information andnotes in a freely available database (eg PostgreSQL > or MySQL) that will bestored on a database server which I do not > have direct access to. This database will be accessed by

Re: [GENERAL] Postgres for Fedora Core 2 OS ****************

2005-07-15 Thread Dianne Yumul
oh, and for installation instructions, please check out the very fine documentation at: http://www.postgresql.org/docs/8.0/interactive/index.html : ) On Jul 15, 2005, at 7:38 AM, Dinesh Pandey wrote: From where can I download?   “Postgres 8.x” + required packages and “installation instruction”

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Joshua D. Drake
I am not an everyday python programmer but I am pretty sure that you are trying to return a list in arf(). You can't return a list you have to return the array type which is why arf2 works. Ok. How does one convert a python list to a PGSql array then? Is there a better way to do it than wh

Re: [GENERAL] Postgres for Fedora Core 2 OS ****************

2005-07-15 Thread Dianne Yumul
Here: http://www.postgresql.org/ftp/binary/v8.0.3/linux/rpms/fedora/fedora-core-2/ If you go to www.postgresql.org, under Downloads, you'll find directions and a link to the FTP mirrors. On Jul 15, 2005, at 7:38 AM, Dinesh Pandey wrote: From where can I download?   “Postgres 8.x” + required pac

Re: [GENERAL] CVS - psql segfault

2005-07-15 Thread Matt Miller
On Fri, 2005-07-15 at 12:27 -0400, Alvaro Herrera wrote: > On Fri, Jul 15, 2005 at 03:47:20PM +, Matt Miller wrote: > > The CVS version of psql was segfaulting > > Did you try "make distclean" before rebuilding? > I had not done "make distclean." After doing this all is well. -

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
Joshua D. Drake wrote: > Peter Fein wrote: > >> Is it possible to return a SETOF text or a text[] from pl/python? >> >> I've got the following test cases: >> >> CREATE OR REPLACE FUNCTION arf() >> RETURNS text[] LANGUAGE plpythonu AS >> $$return ["one", "two", "three"]$$; >> >> SELECT arf(); >> >>

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Joshua D. Drake
Peter Fein wrote: Is it possible to return a SETOF text or a text[] from pl/python? I've got the following test cases: CREATE OR REPLACE FUNCTION arf() RETURNS text[] LANGUAGE plpythonu AS $$return ["one", "two", "three"]$$; SELECT arf(); ERROR: missing dimension value CREATE OR REPLACE FUN

Re: [GENERAL] CVS - psql segfault

2005-07-15 Thread Alvaro Herrera
On Fri, Jul 15, 2005 at 03:47:20PM +, Matt Miller wrote: > The CVS version of psql was segfaulting on exit yesterday, and today's > version segfaults when the program starts. Is this happening to anyone > else? Did you try "make distclean" before rebuilding? -- Alvaro Herrera () Si no sabes

[GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
Is it possible to return a SETOF text or a text[] from pl/python? I've got the following test cases: CREATE OR REPLACE FUNCTION arf() RETURNS text[] LANGUAGE plpythonu AS $$return ["one", "two", "three"]$$; SELECT arf(); ERROR: missing dimension value CREATE OR REPLACE FUNCTION arf2() RETURNS

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Scott Marlowe
On Fri, 2005-07-15 at 10:51, Andrus wrote: > >> I have a table of users permissions by departments > >> > >> CREATE TABLE permission ( > >> id serial, > >> user_id CHAR(10) NOT NULL REFERENCES user, > >> permission_id CHAR(10) NOT NULL REFERENCES privilege, > >> department_id CHAR(10) REF

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Berend Tober
Andrus wrote: How to create constraint so that NULL values are treated equal and second insert is rejected ? Rethink your data design --- this behavior is required by the SQL standard. I have a table of users permissions by departments CREATE TABLE permission ( id serial, user_

Re: [GENERAL] how to insert '\\' in postgres database using java

2005-07-15 Thread Michael Glaesemann
Ketan, Please reply to the list as well so others have the opportunity to help you. And please don't top-post. On Jul 16, 2005, at 12:31 AM, ketan shah wrote: but if i update more then two times then it remove all '\'; and finally it returns 'A' or 'B'... But i want 'A\\d\\d\\

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Andrus
>> I have a table of users permissions by departments >> >> CREATE TABLE permission ( >> id serial, >> user_id CHAR(10) NOT NULL REFERENCES user, >> permission_id CHAR(10) NOT NULL REFERENCES privilege, >> department_id CHAR(10) REFERENCES department , >> UNIQUE ( user_id, permission_id

[GENERAL] CVS - psql segfault

2005-07-15 Thread Matt Miller
The CVS version of psql was segfaulting on exit yesterday, and today's version segfaults when the program starts. Is this happening to anyone else? I'm on Red Hat ES4. My understanding is that the latest code is rarely broken. Is is not unusual for a problem like this to persist for a couple da

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Scott Marlowe
On Fri, 2005-07-15 at 10:26, Andrus wrote: > >> How to create constraint so that NULL values are treated equal and second > >> insert is rejected ? > > > > Rethink your data design --- this behavior is required by the SQL > > standard. > > I have a table of users permissions by departments > > CR

Re: [GENERAL] Looking for a good ERD Tool

2005-07-15 Thread Hannes Dorbath
On 07.07.2005 06:23, Rob Brenart wrote: Anyway, would like to find a similar tool specifically designed for PostgreSQL... does one exist or is it a futile search? I tested almost anything that is out there over the years.. http://www.casestudio.com Works perfect with PG8, fully script- and e

[GENERAL] PLPGSQL how to get transaction isolation level info

2005-07-15 Thread Janning Vygen
i have a function which calculates some aggregates (like a materialized view). As my aggregation is made with a temp table and 5 SQL Queries, i need a consistent view of the database. Therefor i need transaction isolation level SERIALIZABLE, right? Otherwise the second query inside of the func

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Andrus
>> How to create constraint so that NULL values are treated equal and second >> insert is rejected ? > > Rethink your data design --- this behavior is required by the SQL > standard. I have a table of users permissions by departments CREATE TABLE permission ( id serial, user_id CHAR(10) NOT N

Re: [GENERAL] Transparent encryption in PostgreSQL?

2005-07-15 Thread Greg Patnude
The point of a data base is storing ASCII or unicode not encypting the data... encrypting the data IN the database is a bad idea what happens if you ever lose the key ??? you lose ALL your data... Additionally -- encryption keys are usually machine-dependent so you lose the ability to mi

Re: [GENERAL] How to obtain the list of data table name only

2005-07-15 Thread Greg Patnude
Here is the definition of a view I use to retrieve all of the tables and a list of columns for tables that appear in the "public" schema ... I have others that only retrieve a list of the table names and the views in the public schema as well... -- View: "vcat_pgcolumns" -- DROP VIEW vcat_pgc

Re: [GENERAL] how to insert '\\' in postgres database using java

2005-07-15 Thread Michael Glaesemann
Hi Ketan, On Jul 15, 2005, at 10:49 PM, ketan shah wrote: My question : After updation how i get 'A', 'Mr. B', 'A\\d\\d\\d\\d' i.e. not escapeing '\\'. I am using postgres 7.4.6 and java 1.4. pl. help me out... As you've noticed, the \ character is currently used in PostgreS

[GENERAL] Postgres for Fedora Core 2 OS ****************

2005-07-15 Thread Dinesh Pandey
From where can I download?   “Postgres 8.x” + required packages and “installation instruction” of Postgres for Fedora Core 2 OS. Thanks Dinesh Pandey  

Re: [GENERAL] Case insensitive unique constraint

2005-07-15 Thread Vivek Khera
On Jul 14, 2005, at 3:14 AM, Rob Brenart wrote: I have a simple table to store account names... I want each name to be unique in a case insensitive manner... but I want the case the user enters to be remembered so I can't do a simple lower() on the data's way in. Is there an easy way to

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > CREATE TABLE test( col1 CHAR NOT NULL, col2 CHAR, > UNIQUE (col1, col2) ); > This table allows to insert duplicate rows if col2 is NULL: > INSERT INTO test VALUES ( '1', NULL ); > INSERT INTO test VALUES ( '1', NULL ); > does NOT cause error! > How to cr

Re: [GENERAL] how to insert '\\' in postgres database using java

2005-07-15 Thread Ropel
If, as the name of the column suggests, the backslash is used for pathnames, why don't you bypass the problem by using normal slash (I.E: "path/to/my/file")? It works well with new windows versions and, of course, unix-style pathnames Hope this helps, Roberto ketan shah wrote: Hi, All,

[GENERAL] Function returning any (tuple) type

2005-07-15 Thread Ezequiel Tolnay
Hi, I wonder if anyone can help me find a solution for this problem. I'm porting a database from MS SQL Server 2000 to PostgreSQL 8.0.1 (Windows). We have an web interface that accesses the database, but doesn't have direct access on any tables, only to execute a number of stored procedures.

[GENERAL] problem after restoring a backup database on a different PC

2005-07-15 Thread Wesley
Hi I think I might be doing something verry wrong, since i ame not being able to transfer a database from one pc to another. so, what I do is, I dump the database as follows: pg_dump -f "c:\file.backup" -F c -b -x -h localhost -U user -W "MyDB" (or i tried it also using the backup button in p

Re: [GENERAL] Case insensitive unique constraint

2005-07-15 Thread John D. Burger
create unique index tbl_iname_idx on tbl (lower(name_field)) By the way, in case it wasn't obvious, this has a nice side-benefit. Namely, PG will use that index for caseless lookups, so you can do this: select * from tbl where lower(name_field) = lower('John'); very efficiently. - John

[GENERAL] how to insert '\\' in postgres database using java

2005-07-15 Thread ketan shah
Hi,   All,  My name is ketan, i have problem in postgres db insert..  Here is my problem.i have created table like..1)  Create table tab1(usr_id varchar(15), usr_name varchar(20),usr_filename_pattern varchar(1024));  insert table tab1 values('A','Mr. A','A\\d\\d\\d\\d'); Record is successfu

Re: [GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Dawid Kuroczko
On 7/15/05, Andrus <[EMAIL PROTECTED]> wrote: > CREATE TABLE test( col1 CHAR NOT NULL, col2 CHAR, > UNIQUE (col1, col2) ); > INSERT INTO test VALUES ( '1', NULL ); > INSERT INTO test VALUES ( '1', NULL ); > does NOT cause error! > > How to create constraint so that NULL values are treated equal

[GENERAL] uncompressing pgAdmin backup file in windows

2005-07-15 Thread Andrus
I created a backup of Postgres database using pgAdmin II in Windows by default options with (*) COMPRESS radio button checked. How to unpack the created compressed file in windows manually ? ---(end of broadcast)--- TIP 4: Have you searched ou

Re: [GENERAL] Nulls in timestamps

2005-07-15 Thread Bruno Wolff III
On Wed, Jul 13, 2005 at 18:15:12 +, [EMAIL PROTECTED] wrote: > Many thanks Tom. Inconvenient from the point of view of the application but > still useful information. > > The situation is that I've got a query with numerous subselects, each of which > has to return exactly one row so I was d

Re: [GENERAL] re my previous e-mail client-server example

2005-07-15 Thread Bruno Wolff III
On Wed, Jul 13, 2005 at 17:56:44 +0100, John Tulodziecki <[EMAIL PROTECTED]> wrote: > Bizzarly its now working after I added the server ip address in addition to > the client ip address in the listen addresses config line !!! That isn't bizzare. The listen address is what address the server shou

Re: [GENERAL] What's Popular for CMS and RAD with PHP/PostgreSQL?

2005-07-15 Thread John DeSoi
Hi Kevin, On Jul 15, 2005, at 6:57 AM, Kevin Murphy wrote: I too like drupal and use it with postgresql, but some of the Drupal contrib module authors are still very mysql-centric and fond of writing code that breaks when using postgresql (or doesn't support it at all). Luckily, it's usua

Re: [GENERAL] What's Popular for CMS and RAD with PHP/PostgreSQL?

2005-07-15 Thread Kevin Murphy
John DeSoi wrote: CMS and RAD tools out there? Using PHP and PostgreSQL only, what do you feel are the most popular Drupal is a very nice CMS for PHP and PostgreSQL. I'm using it for some consulting projects now and it has saved me a great deal of time. Some of the useful features include

[GENERAL] How to create unique constraint on NULL columns

2005-07-15 Thread Andrus
I have table CREATE TABLE test( col1 CHAR NOT NULL, col2 CHAR, UNIQUE (col1, col2) ); This table allows to insert duplicate rows if col2 is NULL: INSERT INTO test VALUES ( '1', NULL ); INSERT INTO test VALUES ( '1', NULL ); does NOT cause error! How to create constraint so that NULL values a

Re: [GENERAL] Function returning any (tuple) type

2005-07-15 Thread Richard Huxton
Hannes Dorbath wrote: On 15.07.2005 08:51, Ezequiel Tolnay wrote: The main problem I see is that the funcitions in PostgreSQL seem to be always bound to a particular result datatype. Is there a way to circumvent this? I tried to find a solution for this as well some time ago. I don't bel

Re: [GENERAL] Function returning any (tuple) type

2005-07-15 Thread Hannes Dorbath
On 15.07.2005 08:51, Ezequiel Tolnay wrote: The main problem I see is that the funcitions in PostgreSQL seem to be always bound to a particular result datatype. Is there a way to circumvent this? I tried to find a solution for this as well some time ago. I don't believe there is a practical

[GENERAL] Asynchronous connection and command processing.

2005-07-15 Thread John Tulodziecki
Hi there,   Please can someone point me to example code for the following …   Asynchronous connection -  PQconnectStart -  PQconnectPoll   Asynchronous Command Processing -  PQsendQuery -  PQgetResult -  PQconsumeInput   Thankyou.   J