Re: [SQL] create function - user permissions

2000-07-21 Thread Tom Lane
Markus Wagner <[EMAIL PROTECTED]> writes: > one of my users wants to create functions using the C language, but pgs > says "no permission". > How can I permit the user to do this, while avoiding to give him root > access rights? Just a wakeup call here: if you let a user write C functions then y

[SQL] create function - user permissions

2000-07-21 Thread Markus Wagner
Hi, one of my users wants to create functions using the C language, but pgs says "no permission". How can I permit the user to do this, while avoiding to give him root access rights? Thanks, Markus

Re: [SQL] Why do I need to set UPDATE permissions for fkey check?

2000-07-21 Thread Jon Lapham
On Fri, Jul 21, 2000 at 02:00:00PM -0700, Stephan Szabo wrote: > > It's a known problem in the foreign key code. The reason is that > the fk triggers use SELECT FOR UPDATE to select the matching > rows that it is checking and the reason for using FOR UPDATE is > to lock those rows so that someon

Re: [SQL] Why do I need to set UPDATE permissions for fkey check?

2000-07-21 Thread Stephan Szabo
It's a known problem in the foreign key code. The reason is that the fk triggers use SELECT FOR UPDATE to select the matching rows that it is checking and the reason for using FOR UPDATE is to lock those rows so that someone cannot delete/change them out from under your nose while you're looking

[SQL] Why do I need to set UPDATE permissions for fkey check?

2000-07-21 Thread Jon Lapham
Hello all- Running: Pg v7.0.2, home rolled, RedHat 6.2 linux. I am trying to set up a read-only static lookup table, to which other tables will reference. However, it seems I need to GRANT SELECT, UPDATE permissions (at least) on the lookup table in order to perform foreign key integrity checki

Re: [SQL] Timestamp indexes

2000-07-21 Thread Tom Lane
"Mitch Vincent" <[EMAIL PROTECTED]> writes: > Looks like that index scan is very unattractive... Yes, though not as bad as the cost estimator thinks (almost a 5:1 ratio in estimated cost, but hardly any difference in real runtime). Still have some work to do in tweaking the estimates, obviously.

Re: [SQL] Timestamp indexes

2000-07-21 Thread Mitch Vincent
With enable_seqscan off (Same query) Sort (cost=9282.89..9282.89 rows=4880 width=611) -> Index Scan using applicants_created, applicants_resubmitted on applicants a (cost=0.00..8983.92 rows=4880 width=611) ...and.. ! system usage stats: ! 7.541906 elapsed 5.368217 user 2.062897 syste

Re: [SQL] password encryption

2000-07-21 Thread Roderick A. Anderson
On Fri, 21 Jul 2000, Silesky Marketing Inc, Support wrote: > Hello, > > I want to encrypt passwords with Postgresql the way mySQL does it with : > > UPDATE user SET Password=PASSWORD('new_password') WHERE user='root'; Check out the ALTER command. ALTER USER username [ WITH PASSWORD 'passw

Re: [SQL] Timestamp indexes

2000-07-21 Thread Tom Lane
"Mitch Vincent" <[EMAIL PROTECTED]> writes: > select * from applicants as a where (a.created::date > '05-01-2000' or > a.resubmitted::date > '05-01-2000') order by (case when a.resubmitted > > a.created then a.resubmitted else a.created end) desc limit 10 offset 0 > There is one of the queries..

[SQL] password encryption

2000-07-21 Thread Silesky Marketing Inc, Support
Hello, I want to encrypt passwords with Postgresql the way mySQL does it with : UPDATE user SET Password=PASSWORD('new_password') WHERE user='root'; How can I do that ? Thanks a lot, Laurent

Re: [SQL] Timestamp indexes

2000-07-21 Thread Mitch Vincent
select * from applicants as a where (a.created::date > '05-01-2000' or a.resubmitted::date > '05-01-2000') order by (case when a.resubmitted > a.created then a.resubmitted else a.created end) desc limit 10 offset 0 There is one of the queries.. I just remembered that the order by was added since

Re: [SQL] Timestamp indexes

2000-07-21 Thread Tom Lane
"Mitch Vincent" <[EMAIL PROTECTED]> writes: > A while back I as told (by Tom Lane I *think*) that timestamp (previously > datetime) fields couldn't be indexed as such That's certainly not true now, if it ever was... regression=# create table applicants(resubmitted timestamp); CREATE regression=#

Re: [SQL] problem with view and case - please help

2000-07-21 Thread DalTech - CTE
Instead of: > WHEN $1 LIKE \'Mozilla/2.0 %\' AND $1 NOT LIKE \'%MSIE%\' AND $1 NOT > LIKE \'%compatible%\' THEN \'Netscape 2.0\' > WHEN $1 LIKE \'Mozilla/2.02 %\' AND $1 NOT LIKE \'%MSIE%\' AND $1 NOT > LIKE \'%compatible%\' THEN \'Netscape 2.02\' > WHEN $1 LIKE \'Mozilla/2.02E %\' AND $1 NOT LIK

[SQL] Timestamp indexes

2000-07-21 Thread Mitch Vincent
A while back I as told (by Tom Lane I *think*) that timestamp (previously datetime) fields couldn't be indexed as such and that I should index them using this method : CREATE INDEX "applicants_resubmitted" on "applicants" using btree ( date ("resubmitted") "date_ops" ); Since almost all the que

Re: [SQL] problem with view and case - please help

2000-07-21 Thread Ange Michel POZZO
the idea of a funtion is a good idea, thanks a lot ! i am a newbie to sql, after some try, i have made a function like this : create function browser(text) returns text AS 'SELECT CASE WHEN $1 LIKE \'%MSIE 2.0;%\' THEN \'Internet Explorer 2.0\' WHEN $1 LIKE \'%MSIE 3.0;%\' THEN \'Internet Explor

[SQL] Re: [BUGS] problem with view and case - please help

2000-07-21 Thread Tom Lane
Ange Michel POZZO <[EMAIL PROTECTED]> writes: > CREATE VIEW browser > AS > SELECT > agent_i, > CASE > < massive CASE expression > > ELSE agent_i END AS navigateur, count (agent_i) > as total from access group by agent_i; > pqReadData() -- backend closed the channel unexpectedly. Not sure why you

Re: [SQL] using OID as primary key

2000-07-21 Thread D'Arcy J.M. Cain
Thus spake Jan Wieck > > are there any disadvantages of using OID as the primary key for any > > table? > > What about referencing external tuples using their OIDs? > > Currently OID is not supported for references. Has to do with > some checks done in the RI triggers, using SPI funct

Re: [SQL] using OID as primary key

2000-07-21 Thread Jan Wieck
Markus Wagner wrote: > Hi, > > are there any disadvantages of using OID as the primary key for any > table? > What about referencing external tuples using their OIDs? > > e. g.: > CREATE TABLE thistable > ... > field NUMERIC REFERENCES OtherTable (oid) > > Which data type should I use to reference

[SQL] using OID as primary key

2000-07-21 Thread Markus Wagner
Hi, are there any disadvantages of using OID as the primary key for any table? What about referencing external tuples using their OIDs? e. g.: CREATE TABLE thistable ... field NUMERIC REFERENCES OtherTable (oid) Which data type should I use to reference OIDs? Will I run into problems later if

[SQL] Re: [BUGS] problem with view and case - please help

2000-07-21 Thread Jan Wieck
Ange Michel POZZO wrote: > I repost my message because it seems that my previous post don't go on > > i use [PostgreSQL 6.5.2 on i686-pc-linux-gnu, compiled by gcc 2.95.2] > rpm version of Linux Mandrake 7.02 > That's definitely the problem. I cannot recreate it with current CVS sour

Re: [SQL] referencing serials

2000-07-21 Thread Emils Klotins
On 21 Jul 2000, at 9:41, Markus Wagner wrote: > which data type should be used to hold references to SERIALs in external > tables? integer I believe. Actually if you \d a table with a serial you'll see that it's an integer with DEFAULT clause specified.

Re: [SQL] problem with view and case - please help

2000-07-21 Thread Volker Paul
> CREATE VIEW browser > AS > SELECT > agent_i, > CASE > WHEN agent_i LIKE '%MSIE 2.0;%' THEN 'Internet Explorer 2.0' > ... > agent_i NOT LIKE '%compatible%' THEN 'Netscape' > WHEN agent_i LIKE 'Mozilla/5.0 %' AND agent_i NOT LIKE '%MSIE%' AND > agent_i NOT LIKE '%compatible%' THEN 'Netscape' > WHE

[SQL] problem with view and case - please help

2000-07-21 Thread Ange Michel POZZO
I repost my message because it seems that my previous post don't go on i use [PostgreSQL 6.5.2 on i686-pc-linux-gnu, compiled by gcc 2.95.2] rpm version of Linux Mandrake 7.02 i try this query : [ange@ange ange]$ psql zonecommerce -h 192.0.1.84 -u -f toto.sql Username: postgres Password: DROP

Re: [SQL] test

2000-07-21 Thread Jerome Alet
At least you could spell your ads correctly ! - Plusieurs centaines de magasins re'fe'rence's - Les ide'es d'olivia bye, Jerome ALET - [EMAIL PROTECTED] - http://cortex.unice.fr/~jerome Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30 28 Avenue de Valombrose - 06107 NICE

[SQL] test

2000-07-21 Thread Ange Michel POZZO
test -- ** POZZO Ange Michel mail : [EMAIL PROTECTED] Administrateur - Développeur ALPINFO 617 Rue Denis Papin 73290 La Motte Servolex Savoie - France tel : 04 79 26 06 28 fax : 04 79 25 68 36 Zonecommerce, l'annuaire fr

[SQL] referencing serials

2000-07-21 Thread Markus Wagner
Hello, which data type should be used to hold references to SERIALs in external tables? I tried to use SERIAL, but then a sequence is created for the referencing table. Markus