Re: [SQL] Question re: relational technique

2006-03-13 Thread Richard Huxton
Robert Paulsen wrote: This still requires me to modify the overall database structure but not the original item table. As my reward :) I get to use any type I choose for each new attribute. The whole point of the database structure is to accurately reflect the requirements of your data. If yo

[SQL] Permission to Select

2006-03-13 Thread Eugene E.
Hi all the serious problem with permissions is encountered NOTE: the following example is really useful but there is no room to describe it's use. db=# CREATE USER u; db=# CREATE TABLE t (i int, a text); db=# REVOKE all ON t FROM u; db=# GRANT update,insert,delete ON t TO u; db=# \c - u db=>

[SQL] Constraint Error effect on PostgreSQL

2006-03-13 Thread Christian Paul B. Cosinas
Hi Fellow PostgreSQL users, Just a question here. Is there any bad effect on the PostgreSQL performance If I encounter many fails on inserting records to database with primary key column. For example I have this table CREATE TABLE unique_items ( item_id text NOT NULL, CONSTRAINT unique_item

Re: [SQL] Question re: relational technique

2006-03-13 Thread Robert Paulsen
On Monday 13 March 2006 03:03, Richard Huxton wrote: > Robert Paulsen wrote: > > This still requires me to modify the overall database structure but not > > the original item table. As my reward :) I get to use any type I choose > > for each new attribute. > > The whole point of the database struct

Re: [SQL] Set generating functions and subqueries

2006-03-13 Thread Markus Schaber
Hi, Tom, Tom Lane wrote: > The behavior of the subquery expression is dictated by the SQL spec: > > 1) If the cardinality of a or a is > greater than 1, then an exception condition is raised: cardinal- > ity violation. That's interesting to know, and it seems

[SQL] removing "not null" modifier

2006-03-13 Thread Robert Urban
Hello, let's say I have created a postgresql-7.2.2 db using the following cmds: CREATE TABLE status ( id SERIAL NOT NULL PRIMARY KEY, name VARCHAR(32) ); CREATE TABLE event ( id SERIAL NOT NULL PRIMARY KEY,

Re: [SQL] removing "not null" modifier

2006-03-13 Thread Achilleus Mantzios
O Robert Urban έγραψε στις Mar 13, 2006 : > Hello, > > let's say I have created a postgresql-7.2.2 db using the following cmds: > > CREATE TABLE status > ( > id SERIAL NOT NULL PRIMARY KEY, > name VARCHAR(32) > ); > > CREATE TABLE event >

Re: [SQL] Ask a PostgreSql question (about select )

2006-03-13 Thread Daniel Caune
> Objet : Re: [SQL] Ask a PostgreSql question (about select ) > > Please post questions to the list. I'm forwarding this to the SQL > list, as I think it's probably most applicable. I don't know much > about the Oracle syntax you've used. Hopefully someone will be able > to help you. > > On Mar 1

Re: [SQL] Permission to Select

2006-03-13 Thread Rod Taylor
On Mon, 2006-03-13 at 12:51 +0300, Eugene E. wrote: > Hi all > the serious problem with permissions is encountered > > NOTE: the following example is really useful but there is no room to > describe it's use. > > > db=# CREATE USER u; > db=# CREATE TABLE t (i int, a text); > db=# REVOKE all ON

Re: [SQL] Permission to Select

2006-03-13 Thread Alvaro Herrera
Rod Taylor wrote: > By allowing the user a where clause you grant them select privileges. > You will find that delete works the same way. > > This is one of those times when per column permissions are useful. You > could grant them select access on the "name" column but not the "salary" > column.

Re: [SQL] Set generating functions and subqueries

2006-03-13 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> The fact that the other form is even allowed is more of a holdover from >> PostQUEL than something we have consciously decided is a good idea. >> (IMHO it's actually a fairly *bad* idea, because it does not work nicely >> when there's

Re: [SQL] Permission to Select

2006-03-13 Thread Rod Taylor
On Mon, 2006-03-13 at 10:46 -0400, Alvaro Herrera wrote: > Rod Taylor wrote: > > > By allowing the user a where clause you grant them select privileges. > > You will find that delete works the same way. > > > > This is one of those times when per column permissions are useful. You > > could grant

Re: [SQL] Permission to Select

2006-03-13 Thread Tom Lane
"Eugene E." <[EMAIL PROTECTED]> writes: > db=# REVOKE all ON t FROM u; > db=# GRANT update,insert,delete ON t TO u; > db=# \c - u > db=> INSERT INTO t VALUES (1,'x'); > INSERT > db=> UPDATE t SET a='y' WHERE i=1; > ERROR: Permission denied for relation t; > db=> UPDATE t SET a='y'; > UPDATE This

[SQL] connectby documentation

2006-03-13 Thread Daniel Caune
Hi, I'm searching for an Oracle START WITH ... CONNECT BY PRIOR ... equivalence. It seems that PostgreSQL (version >= 7.4) supports a function connectby that provides similar feature. Unfortunately I don't find any documentation on that function. Could you please give me a link on such document

Re: [SQL] removing "not null" modifier

2006-03-13 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > O Robert Urban Ýãñáøå óôéò Mar 13, 2006 : >> how can I get rid of the "not null" modifier on status_id? > ALTER TABLE event ALTER status_id DROP NOT NULL; I don't think 7.2 has that. Of course, there are many excellent reasons why Robert needs t

Re: [SQL] connectby documentation

2006-03-13 Thread Michael Fuhr
On Mon, Mar 13, 2006 at 10:37:37AM -0500, Daniel Caune wrote: > I'm searching for an Oracle START WITH ... CONNECT BY PRIOR ... > equivalence. It seems that PostgreSQL (version >= 7.4) supports a > function connectby that provides similar feature. Unfortunately I don't > find any documentation on

Re: [SQL] Constraint Error effect on PostgreSQL

2006-03-13 Thread Richard Huxton
Christian Paul B. Cosinas wrote: Then I have a program that insert 1(one) million times like this: Insert into unique_items(item_id) values('Item001) Ofcourse we all know that it will fail because there is already a record in the database. Would there be any bad effect on the database or none

Re: [SQL] Permission to Select

2006-03-13 Thread PFC
What information can be retrieved from a structure by being able to update all rows? Write a plpgsql function snoop(x) which inserts x into a table 'log' created by you, and also returns x. UPDATE users SET password=snoop(password). Read log table. Done. If you h

Re: [SQL] connectby documentation

2006-03-13 Thread Daniel Caune
> -Message d'origine- > De : Michael Fuhr [mailto:[EMAIL PROTECTED] > Envoyé : lundi, mars 13, 2006 11:12 > À : Daniel Caune > Cc : postgresql sql list > Objet : Re: [SQL] connectby documentation > > On Mon, Mar 13, 2006 at 10:37:37AM -0500, Daniel Caune wrote: > > I'm searching for an O

Re: [SQL] connectby documentation

2006-03-13 Thread PFC
7.4?! Huh... Is there any sources.list a bit more updated? Where can I download PostgreSQL contrib modules. The documentation 8.1 doesn't help so much. Where can I find more documentation on available contrib. modules? gentoo automatically compiles and installs the contribs (you just

Re: [SQL] connectby documentation

2006-03-13 Thread Daniel Caune
> "outdated" packets is unfortunately a big issue on Debian. If you want > to have up-to-date apt-packages try > > www.backports.org > > Add one of the mirrors from the list to your sources.list, then run > apt-get update and then try to install again ... > :-) And you'll see, that you can instal

[SQL] Update value to "the first character is capital and the rest is small"

2006-03-13 Thread Emi Lu
Hello all, Does anyone have available plpgsql codes to update all capital letters in a column to "the first character is capital and the rest is small" ? For example, in tableA(id, description) 001, 'ZHANG ZHE XIN' => 'Zhang Zhe Xin' 002, 'LIU

Re: [SQL] Update value to "the first character is capital and the rest is small"

2006-03-13 Thread Alvaro Herrera
Emi Lu wrote: > Hello all, > > Does anyone have available plpgsql codes to update all capital letters > in a column to "the first character is capital and the rest is small" ? I don't know about plpgsql codes, but there is a function initcap() that you can use for that. alvherre=# select initca

Re: [SQL] [GENERAL] Update value to "the first character is capital and

2006-03-13 Thread Emi Lu
I got the answer from the docs. |initcap|(text) thanks anyway, Ying Hello all, Does anyone have available plpgsql codes to update all capital letters in a column to "the first character is capital and the rest is small" ? For example, in tableA(id, description) 001, 'ZHANG ZHE XIN'

Re: [SQL] connectby documentation

2006-03-13 Thread Michael Fuhr
On Mon, Mar 13, 2006 at 04:56:39PM -0500, Daniel Caune wrote: > Sorry, this is not my day: "apt-get install postgresql-contrib-8.1" > works fine... Just a link on the documentation that fully explains how > connectby() works would be great! :-) The contrib package should have installed a file nam

Re: [GENERAL] [SQL] Update value to "the first character is capital

2006-03-13 Thread Emi Lu
I saw it from the docs as well. Thank you Alvaro :) Alvaro Herrera wrote: Emi Lu wrote: Hello all, Does anyone have available plpgsql codes to update all capital letters in a column to "the first character is capital and the rest is small" ? I don't know about plpgsql codes, but

Re: [SQL] connectby documentation

2006-03-13 Thread Daniel Caune
> > Sorry, this is not my day: "apt-get install postgresql-contrib-8.1" > > works fine... Just a link on the documentation that fully explains how > > connectby() works would be great! :-) > > The contrib package should have installed a file named README.tablefunc. > You are right. The documen

Re: [SQL] connectby documentation

2006-03-13 Thread Daniel Caune
> > > Sorry, this is not my day: "apt-get install postgresql-contrib-8.1" > > > works fine... Just a link on the documentation that fully explains > how > > > connectby() works would be great! :-) > > > > The contrib package should have installed a file named > README.tablefunc. > > > > You are

Re: [SQL] connectby documentation

2006-03-13 Thread Michael Fuhr
On Mon, Mar 13, 2006 at 06:38:14PM -0500, Daniel Caune wrote: > I provide hereafter a description about how to install the function > connectby (I didn't find such documentation and I don't know where to > write this documentation): README.tablefunc contains instructions on how to load the module

Re: [SQL] connectby documentation

2006-03-13 Thread Daniel Caune
> -Message d'origine- > De : Michael Fuhr [mailto:[EMAIL PROTECTED] > Envoyé : lundi, mars 13, 2006 19:26 > À : Daniel Caune > Cc : [EMAIL PROTECTED]; postgresql sql list > Objet : Re: [SQL] connectby documentation > > On Mon, Mar 13, 2006 at 06:38:14PM -0500, Daniel Caune wrote: > > I p

Re: [SQL] connectby documentation

2006-03-13 Thread Michael Fuhr
On Mon, Mar 13, 2006 at 07:29:44PM -0500, Daniel Caune wrote: > > > Replace "$libdir" by "/usr/lib/postgresql/8.1/lib/tablefunc.so" (I > > > suggest to modifying only a copy of this file). > > > > That shouldn't be necessary unless the package installed the shared > > objects somewhere other than

[SQL] unsubscribe

2006-03-13 Thread Arulmani V A
unsubscribe __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your

[SQL] unsubscribe

2006-03-13 Thread RaFaeL
unsubscribe

[SQL] unsubscribe

2006-03-13 Thread Kenneth Hutchinson
unsubscribe   This message is intended only for the use of the individual(s) or entity to which it is addressed and may contain information that is privileged, confidential, and/or proprietary to RealPage and its affiliated companies. If the reader of this message is not the intended recip

Re: [SQL] Permission to Select

2006-03-13 Thread Eugene E.
Tom Lane wrote: "Eugene E." <[EMAIL PROTECTED]> writes: db=# REVOKE all ON t FROM u; db=# GRANT update,insert,delete ON t TO u; db=# \c - u db=> INSERT INTO t VALUES (1,'x'); INSERT db=> UPDATE t SET a='y' WHERE i=1; ERROR: Permission denied for relation t; db=> UPDATE t SET a='y'; UPDATE

Re: [SQL] Permission to Select

2006-03-13 Thread Eugene E.
PFC wrote: What information can be retrieved from a structure by being able to update all rows? Write a plpgsql function snoop(x) which inserts x into a table 'log' created by you, and also returns x. UPDATE users SET password=snoop(password). Read log table. Done. This

Re: [SQL] Permission to Select -- I am wrong

2006-03-13 Thread Eugene E.
Eugene E. wrote: PFC wrote: What information can be retrieved from a structure by being able to update all rows? Write a plpgsql function snoop(x) which inserts x into a table 'log' created by you, and also returns x. UPDATE users SET password=snoop(password). Read log tab

[SQL] Copying a row within table

2006-03-13 Thread Aarni Ruuhimäki
Hi people, testing=# INSERT INTO foo (SELECT * FROM foo WHERE foo_id = 2); ERROR: duplicate key violates unique constraint "foo_pkey" testing=# testing=# INSERT INTO foo (foo_1, foo_2, foo_3 ...) (SELECT foo_1, foo_2, foo_3 ... FROM message_table WHERE foo_id = 10); INSERT 717286 1 testing=# I