Re: [GENERAL] NULL values and string

2006-02-02 Thread Berend Tober
NULL is designed for, but it sure is convenient. Regards, Berend Tober ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [GENERAL] Image in postgresql 7.3

2006-01-18 Thread Berend Tober
Peerri (sent by Nabble.com) wrote: I'm with problems to record images in database in field type bytea. I'm using visual basic 6.0 and object ado stream to convert binary. They say me if another way exists to record the images in the data base. This may not be for the faint of heart, but

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Berend Tober
that might not be feasible depending on circumstances, like dropping and recreating the table and reloading data, but you have to deal with foreign key and other dependencies and so it is probably more work than justifiable for something that makes no practical difference. Regards, Berend Tober

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Berend Tober
, although the transaction block prehaps provides appropriate protection. Regards, Berend Tober ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] Question

2005-11-29 Thread Berend Tober
Peter Futaro wrote: I need to make a documentation for my database. The documentation I want is almost exactly like the result of \d command. I want to make the report using a database manager application, and it requires me to make my own report by typing the SQL command in it. Can you

[GENERAL] Function name variable within a non-trigger function

2005-11-24 Thread Berend Tober
I know that within a trigger function the functin name can be referenced by the special variable TG_NAME, so I could include raise an exception that identified its source with a line like: RAISE EXCEPTION ''ERROR IN %'', TG_NAME; Is there a similar set of special variables defined for

[GENERAL] Multi-parameter aggregates.

2005-11-21 Thread Berend Tober
I'm interested in defining a covariance aggregate function. (As a refresher, remember that covariance is a little bit like variance, but is between two variables: cov(X,Y)= XY - XY, where the angular brackets in this case denote taking the averag. Variance is a special case when X and Y

Re: [GENERAL] Multi-parameter aggregates.

2005-11-21 Thread Berend Tober
Hakan Kocaman wrote: have you considered using pl/r. http://www.joeconway.com/plr/ I think R got a covariance-function. http://www.r-project.org/ That would be, like, the easy way. Thanks! Berend begin:vcard fn:Berend Tober n:Tober;Berend org:Seaworthy Systems, Inc. adr:;;22 Main

Re: [GENERAL] Multi-parameter aggregates.

2005-11-21 Thread Berend Tober
Michael Fuhr wrote: On Mon, Nov 21, 2005 at 11:03:22AM -0500, Berend Tober wrote: I'm interested in defining a covariance aggregate function. I think aggregates must take a single value, so the above won't work as written. However, in PostgreSQL 8.0 or later you could define

Re: [GENERAL] Most significant digit number formatting

2005-11-17 Thread Berend Tober
suppose I can accomplish this formatting programmatically within the Delphi application, but I was hoping to have the data base do it directly. Thanks, Berend Tober Berend Tober [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Say I want to format calculated numeric output

[GENERAL] Most significant digit number formatting

2005-11-15 Thread Berend Tober
, Berend Tober begin:vcard fn:Berend Tober n:Tober;Berend org:Seaworthy Systems, Inc. adr:;;22 Main Street;Centerbrook;CT;06409;USA email;internet:[EMAIL PROTECTED] tel;work:860-767-9061 url:http://www.seaworthysys.com version:2.1 end:vcard ---(end of broadcast

Re: [GENERAL] Duplicate Row Removal

2005-11-05 Thread Berend Tober
Dean Gibson (DB Administrator) wrote: CREATE TABLE new_name AS SELECT DISTINCT * FROM old_name; DROP TABLE old_name; ALTER TABLE new_name RENAME TO old_name; The problem with this technique is that it doesn't account for indexes, foreign key references, and other dependencies. Another

Re: [GENERAL] getting around---division by zero on numeric

2005-10-19 Thread Berend Tober
Richard Huxton wrote: Tim Nelson wrote: I am getting division by zero on a calculated field ( sum(sales) is 0 ) It's a two-stage process, so you'll want a sub-query. Something like: ... Thanks. That's a cool addition to my bag of tricks. ---(end of

Re: [GENERAL] Dump all except some tables?

2005-10-06 Thread Berend Tober
WireSpot wrote: Is it possible to dump an entire database but to skip one or two tables? Or, conversely, to restore an entire dump except for one or two tables? (Although I'd prefer the first version.) The only related option for both pg_dump and pg_restore is --table, which only takes 1

Re: [GENERAL] Securing Postgres

2005-10-05 Thread Berend Tober
L van der Walt wrote: I would like to secure Postgres completly. Some issues that I don't know you to fix: 1. User postgres can use psql (...) to do anything. 2. User root can su to postgres and thus do anything. 3. Disable all tools like pg_dump How do I secure a database if I don't trust

Re: [GENERAL] Implementing a change log

2005-09-20 Thread Berend Tober
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 My original intention was to keep two sets of tables. The first containing only the working set of current records. The second containing all prior versions. I haven't experimented with such a setup yet and I'm

Re: [GENERAL] Implementing a change log

2005-09-20 Thread Berend Tober
Berend Tober wrote: ...See User Comments at http://www.postgresql.org/docs/8.0/interactive/tutorial-inheritance.html; for something that should set you afire. And, commenting on my own post, try this cool function: /* The following is based on suggestion by Mike Rylander posted

Re: [GENERAL] Implementing a change log

2005-09-20 Thread Berend Tober
Mike Rylander wrote: On 9/20/05, Berend Tober [EMAIL PROTECTED] wrote: /* The following is based on suggestion by Mike Rylander posted on Postgresql-General Sun, 18 Sep 2005 23:29:51 + Rylander's original suggestion employed a trigger and tracked only row updates. My implementation

Re: [GENERAL] help me learn

2005-09-12 Thread Berend Tober
suresh ramasamy wrote: i'm new to postgreSQL as well as new to database concepts. please tell me how can i learn. i mean the easiest and fast way. Your help will be appreciated. Make an appropriate posting to pgsql-jobs? ---(end of

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,

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] Backing up multiple databases

2005-06-17 Thread Berend Tober
@postgresql.org # # Modified by Berend Tober 2005-06-17 to: # a) include tcp port as command line parameter. # b) include syntax help. # c) include Postgresql version information in global.sql output file. # d) append .sql file name suffix to dump output file. # e) output

Re: [GENERAL] enebling regular user to create new users ?

2005-06-15 Thread Berend Tober
Zlatko Mati wrote: I know that superusers are allowed to do everything on the database, but I consider this as dangerous. I want to have some user group with rights of creating new users and giving them some authorizations, but without such wide power as superusers have. So, I was thinking

Re: Inherited constraints and search paths (was Re: [GENERAL] Preserving

2005-05-20 Thread Berend Tober
Tom Lane wrote: Berend Tober [EMAIL PROTECTED] writes: Now what, oh most wise one? OK, now I finally get the point: you are creating child tables in different schemas than their parents live in. This creates a problem because reverse-listing of the constraints varies depending on what

Re: [HACKERS] Inherited constraints and search paths (was Re: [GENERAL]

2005-05-20 Thread Berend Tober
Simon Riggs wrote: On Thu, 2005-05-19 at 23:27 -0400, Tom Lane wrote: Berend Tober [EMAIL PROTECTED] writes: Now what, oh most wise one? OK, now I finally get the point: you are creating child tables in different schemas than their parents live in. ... Comments anyone

Re: [GENERAL] [HACKERS] Inherited constraints and search paths (was

2005-05-20 Thread Berend Tober
Tom Lane wrote: ... I just ran into another inheritance-related oddness. Well maybe it is not really an oddness -- you tell me. The problem stems from the fact that I did not originally plan on using inhertiance and so did not include the ONLY keyword in the FROM clause of queries coded into

[GENERAL] Preserving data after updates

2005-05-19 Thread Berend Tober
A few months ago, a question by Scott Frankel produced a suggestion from Greg Patnude which I found very exciting that had to do with using pg table inheritance to maintain an audit or row change history table. I've been testing Patnude's idea and ran into a problem, described below, and

Re: [GENERAL] Postgres in government

2005-05-19 Thread Berend Tober
Scott Marlowe wrote: On Wed, 2005-05-18 at 21:24, Mark Steckel wrote: ...We are proposing that Postgres be used for the application database. Not too surprisingly we are being asked for additional information because Postgres is open source. So is the implication that they think open

Re: [GENERAL] Preserving data after updates

2005-05-19 Thread Berend Tober
Tom Lane wrote: Berend Tober [EMAIL PROTECTED] writes: But after doing a dump of the modified data base, the script created by pg dump wants to recreate the history table as ... CONSTRAINT person_name_check CHECK (((last_name IS NOT NULL) OR (first_name IS NOT NULL))), Hmm

Re: [GENERAL] preserving data after updates

2005-05-19 Thread Berend Tober
Greg Patnude wrote: Yeah this is where the inheritance model gets a little funky What do you have SQL_INEHERITANCE set to when you dump the database ? Ive never tested this so I dont know if it makes a difference being on or off when you dump a table. You might try it and compare the two

Re: [GENERAL] Preserving data after updates

2005-05-19 Thread Berend Tober
Tom Lane wrote: The case I tested seems to work in 7.3 as well: CREATE TABLE person (last_name varchar(24), first_name varchar(24), CONSTRAINT person_name_check CHECK (((last_name IS NOT NULL) OR (first_name IS NOT NULL; CREATE TABLE person_change_history( action VARCHAR(6),

Re: [GENERAL] Preserving data after updates

2005-05-19 Thread Berend Tober
Tom Lane wrote: What do you get from select conname, consrc from pg_catalog.pg_constraint where contype = 'c' and conrelid = 'person'::regclass; conname | consrc

Re: [GENERAL] Preserving data after updates

2005-05-19 Thread Berend Tober
Tom Lane wrote: What do you get from select conname, consrc from pg_catalog.pg_constraint where contype = 'c' and conrelid = 'person'::regclass; conname | consrc

Re: [GENERAL] Postgres mystery

2005-03-30 Thread Berend Tober
Michael Fuhr wrote: On Wed, Mar 30, 2005 at 09:11:09AM +0200, Shaun Clements wrote: Can anyone tell me what the problem is here: I am inserting into a table via a stored procedure, to a few columns within the table and postgres is throwing a CANNOT EXECUTE NULL QUERY. EXECUTE ''INSERT INTO

Re: [GENERAL] preserving data after updates

2005-03-04 Thread Berend Tober
I use a modified form of option 3 with an ON UPDATE RULE the update rule copies the row to an inherited table... I just gotta say that THAT is one COOL use of PG inheritance! Do you find that it works well and is robust and all the good stuff it seems like would be the case? -- Berend

Re: [GENERAL] change user password

2005-02-17 Thread Berend Tober
hi, is it possible to change the current user's password from a function/stored procedure , I mean, is there a system function/stored procedure to do it? like the dbo.sp_password found in adaptive server anywhere. CREATE OR REPLACE FUNCTION public.alter_password(name, name) RETURNS

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

2005-02-12 Thread Berend Tober
Tony Caduto wrote: Hi, Does anyone know if there is a way to get the backends IP address from the PID? I am using the view pg_stat_activity and it would be nice if it would also display the IP address along with the PID. I can see the IP address when I do a ps -ef but it would be nice to

Re: [GENERAL] Problem performing a restore of a data schema in Wi

2005-02-08 Thread Berend Tober
-Original Message- From: John DeSoi [mailto:[EMAIL PROTECTED] Sent: 07 February 2005 04:21 PM To: Shaun Clements Cc: 'PgSql General' Subject: Re: [GENERAL] Problem performing a restore of a data schema in Windows On Feb 7, 2005, at 8:22 AM, Shaun Clements wrote: psql -U

Re: [GENERAL] Sorting when '*' is the initial character - solved

2005-02-08 Thread Berend Tober
On Tue, 8 Feb 2005 01:10 pm, CoL wrote: hi, Berend Tober wrote, On 2/7/2005 22:20: I encountered what looks like unusually sorting behavior, and I'm wondering if anyone can tell me if this is supposted to happen (and then if so, why) or if this is a bug: -- With 8.0.0 C

Re: [GENERAL] Help with sorting (ie. ORDER BY expression)

2005-02-08 Thread Berend Tober
This can be easily done with pl/pgsql, visit the documentation at http://www.postgresql.org/docs/7.3/interactive/programmer-pl.html OT: seems like this is a questionnaire/survey application, yes? - - Jonel Rienton FWIW, given the signature: Reuben D. Budiardja, Dept. Physics and

Re: [GENERAL] create aggregates to concatenate

2005-02-08 Thread Berend Tober
i just wanted to share this with you, i wanted to do something like this for a long time but just recently found out about create aggregate reading old posts, so here it is, using user-defined aggregate functions to concatenate results. when it's numbers i usually use SUM to compute totals,

Re: [GENERAL] create aggregates to concatenate

2005-02-08 Thread Berend Tober
i just wanted to share this with you, i wanted to do something like this for a long time but just recently found out about create aggregate reading old posts, so here it is, using user-defined aggregate functions to concatenate results. when it's numbers i usually use SUM to compute totals,

[GENERAL] Sorting when * is the initial character

2005-02-07 Thread Berend Tober
I encountered what looks like unusually sorting behavior, and I'm wondering if anyone can tell me if this is supposted to happen (and then if so, why) or if this is a bug: CREATE TABLE sample_table ( account_id varchar(4), account_name varchar(25) ) WITHOUT OIDS; INSERT INTO sample_table

Re: [GENERAL] When is a blank not a null or ''

2005-02-02 Thread Berend Tober
anyone any ideas If yes you should you have to use. SELECT first_name,work_email FROM tb_contacts WHERE tb_contacts.work_email '' AND tb_contacts.work_email IS NOT NULL; See what happens with SELECT first_name, work_email, LENGTH(COALESCE(work_email, '')) FROM tb_contacts WHERE

Re: [GENERAL] pgplsql SELECT INTO ... FOR UPDATE

2004-12-15 Thread Berend Tober
I'm trying to write a stored procedure in plpgsql that selects a row and possibly increments one of its fields. I thought I would do SELECT INTO my_record * FROM my_table FOR UPDATE WHERE ..., but apparently plpgsql doesn't like the FOR UPDATE in a stored procedure. Does plpgsql automatically

Re: [GENERAL] table inheritance and DB design

2004-12-03 Thread Berend Tober
On Thu, Dec 02, 2004 at 10:53:37PM -0500, Berend Tober wrote: I learned that the unusual behavior (or at least the behavior that seems weird to me) regarding relational integrity and uniquness constraints as been around for a while, and some people actually think is is SUPPOSED to work

Re: [GENERAL] table inheritance and DB design

2004-12-03 Thread Berend Tober
...have a Resource table and a Car table and a ResCar many-to-many relation. I don't think you need the ResCar table. The Car table defines a many-to-many relation with Appointment. As does the Resource table. The Car table contains a subset of rows from the Resource table. ...it's not

Re: [GENERAL] Rules

2004-12-02 Thread Berend Tober
Planning on witting a rule for a view, and i was wondering if anyone could suggest a good Internet resource? http://www.postgresql.org (Sorry, couldn't resist.) ---(end of broadcast)--- TIP 7: don't forget to increase your free space map

Re: [GENERAL] Rules

2004-12-02 Thread Berend Tober
Planning on witting a rule for a view, and i was wondering if anyone could suggest a good Internet resource? http://www.postgresql.org (Sorry, couldn't resist.) But here is a simple working example of making a view updatable: CREATE TABLE consumable ( consumable_pk serial NOT NULL,

Re: [GENERAL] table inheritance and DB design

2004-12-02 Thread Berend Tober
I am trying to create a database, which allows me to store appointment information. ... Now, I want to have several tables, say Car and Driver, which INHERIT from the Resource table. I also want AppRes table can enforce a ref. constraint on the Resource table. So, in the future I can add a

<    1   2