[BUGS] BUG #1142: Problem with update permissions for view

2004-04-27 Thread PostgreSQL Bugs List

The following bug has been logged online:

Bug reference:  1142
Logged by:  Arturs Zoldners

Email address:  [EMAIL PROTECTED]

PostgreSQL version: 7.4

Operating system:   Linux (RedHat 9 distrib.)

Description:Problem with update permissions for view

Details: 

>From PostgreSQL 7.4.2 Documentation (34.4. Rules and Privileges): 
"...user only needs the required privileges for the tables/views that he 
names explicitly in his queries..." 

However, in this example this is not so:

SET SESSION AUTHORIZATION 'postgres';

SELECT version();
--(PostgreSQL 7.4.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 
20030222 (Red Hat Linux 3.2.2-5)) 

REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;

SET search_path = public, pg_catalog;

CREATE TABLE private_data (
id serial NOT NULL,
a integer
);

REVOKE ALL ON TABLE private_data FROM PUBLIC;

CREATE VIEW public_data AS
SELECT private_data.id, private_data.a FROM private_data;

REVOKE ALL ON public_data FROM PUBLIC;
GRANT SELECT,RULE,UPDATE ON public_data TO x;

CREATE TABLE private_log (
old_val integer,
new_val integer
);

REVOKE ALL ON TABLE private_log FROM PUBLIC;

COPY private_data (id, a) FROM stdin;
1   1
\.

CREATE RULE on_update  AS ON UPDATE TO public_data DO INSTEAD UPDATE 
private_data SET a = new.a WHERE (private_data.id = old.id); 
SELECT pg_catalog.setval('private_data_id_seq', 1, true);

COMMENT ON SCHEMA public IS 'Standard public schema';

--

UPDATE public_data SET a=2 WHERE id = 1;
--(UPDATE 1)

SET SESSION AUTHORIZATION 'x';
UPDATE public_data SET a=3 WHERE id = 1;
--(UPDATE 1)

-- The following rule prevents user x to update public_data: 
SET SESSION AUTHORIZATION 'postgres';
CREATE RULE log_public AS ON UPDATE TO private_data WHERE (new.a <> old.a) 
DO INSERT INTO private_log (old_val, new_val) VALUES (old.a, new.a); 

UPDATE public_data SET a=4 WHERE id = 1;
--(UPDATE 1)

SET SESSION AUTHORIZATION 'x';
UPDATE public_data SET a=5 WHERE id = 1;

The error message from last input line is:

ERROR:  permission denied for relation public_data,

However, user x _has_ SELECT, RULE, UPDATE permissions on public_data.

Best regards,
AZ



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[BUGS] BUG #1143: comments don't get propagated

2004-04-27 Thread PostgreSQL Bugs List

The following bug has been logged online:

Bug reference:  1143
Logged by:  comments on database

Email address:  [EMAIL PROTECTED]

PostgreSQL version: 7.4

Operating system:   Freebsd 4.9-RELEASE

Description:comments don't get propagated

Details: 

My system:
`uname -r`:  4.9-RELEASE-p3
postgres version
==> select version():   PostgreSQL 7.4.2 on i386-portbld-freebsd4.9, 
compiled by GCC 2.95.4 

actually it's not a bug, but it's not a feature, definitely. ;-)

I did a "create database testdb" from psql without a file ${HOME}/.pgsqlrc. 
The initial database was "template1". Then i tried a "comment on database 
testdb is '...';" 
==> cannot create comment

--> I'm using LC_ALL=de_AT.ISO8859-15

translated: database comments can be applied to current database only
so I did a "\c testdb"
and then "comment on database testdb is '...';"

success!

but after "\c tempalte1"
"\l+" doesn't give the comment on testdb.

probably the fact is that pg_database is the same across a cluster, but 
pg_catalog.pg_description is not. 

After I did a "\c testdb" i saw the the comment.

The docu says that pg_catalog.pg_database is shared between the cluster. 
Probably the same should be true for pg_description, since all oid are 
unique across the cluster. ?! 

In my opinion this fact could confuse some people.

BTW:
Could You give an example of an insert statement to pg_description to 
circumvent this inconvenience. 

thnx Oliver



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[BUGS] BUG #1144: comments don't get propagated

2004-04-27 Thread PostgreSQL Bugs List

The following bug has been logged online:

Bug reference:  1144
Logged by:  comments on database

Email address:  [EMAIL PROTECTED]

PostgreSQL version: 7.4

Operating system:   Freebsd 4.9-RELEASE

Description:comments don't get propagated

Details: 

My system:
`uname -r`:  4.9-RELEASE-p3
postgres version
==> select version():   PostgreSQL 7.4.2 on i386-portbld-freebsd4.9, 
compiled by GCC 2.95.4 

actually it's not a bug, but it's not a feature, definitely. ;-)

I did a "create database testdb" from psql without a file ${HOME}/.pgsqlrc. 
The initial database was "template1". Then i tried a "comment on database 
testdb is '...';" 
==> cannot create comment

--> I'm using LC_ALL=de_AT.ISO8859-15

translated: database comments can be applied to current database only
so I did a "\c testdb"
and then "comment on database testdb is '...';"

success!

but after "\c tempalte1"
"\l+" doesn't give the comment on testdb.

probably the fact is that pg_database is the same across a cluster, but 
pg_catalog.pg_description is not. 

After I did a "\c testdb" i saw the the comment.

The docu says that pg_catalog.pg_database is shared between the cluster. 
Probably the same should be true for pg_description, since all oid are 
unique across the cluster. ?! 

In my opinion this fact could confuse some people.

BTW:
Could You give an example of an insert statement to pg_description to 
circumvent this inconvenience. 

thnx Oliver



---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


[BUGS] Silent int overflow

2004-04-27 Thread Jim C. Nasby
stats=# select 1*10, 1*10::bigint;
  ?column?  |?column?
+
 1316134912 | 10
(1 row)

Shouldn't the first expression throw an error instead of rolling over
silently?

Version 7.4.2 if it matters...
-- 
Jim C. Nasby, Database Consultant  [EMAIL PROTECTED]
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


[BUGS] Multi-process transactions [share connections]

2004-04-27 Thread Ruslan A Dautkhanov
Hello !
I have complex system, which use PostgreSQL as a storage. 
Web-interface use Apache+mod_perl, Pg.pm for connection.
I also have kernel of the system written in C++, which 
works as a UNIX daemon and process request from frontend
mod_perl scripts. In some cases it needs to share transaction
along the forntend script [mod_perl process] and kernel
process [other process]. Is it possible? 
If yes, what and how I must pass to kernel process?
Just connection_handler variable? Is perl[Pg.pm]::PQconnectdb return
value compatible with C[libpq]::PQsetdbLogin's function return value?
It is enough to pass only this variable to work with high-grade
transactions etc support in this case?

Thanks a lot for any helpful information.
--
best regards,
Ruslan A Dautkhanov  [EMAIL PROTECTED]


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [BUGS] make check regression "test stats" failed

2004-04-27 Thread Tom Lane
"Mike Quinn" <[EMAIL PROTECTED]> writes:
> [ $subject ]

The stats collector isn't starting, but you're not showing any evidence
to suggest why.  Try looking in the postmaster log file for related
error messages.

regards, tom lane

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [BUGS] Problem when truncate table and get the OID from PQftable

2004-04-27 Thread Tom Lane
"Rodrigo Moreno" <[EMAIL PROTECTED]> writes:
> After truncate the table, the oid retuned by PQftable/libpq returns the old
> value, and i'm not able to find it in pg_class, because the value of
> pg_class.relfilenode was changed after the truncate.

Why are you matching it against relfilenode?  It is the OID.

regards, tom lane

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match