[GENERAL] postgress 8.1.4 deadlocking??

2006-09-27 Thread Rafal Pietrak
Hi, I fell into the following problem (unfortunately, the database contents has sensitive customer information, so can publish very little of that). Currently postgress process takes close to 100% CPU time. I've restarted the process a moment ago, and it was calm for a brief minute. It started

Re: [GENERAL] postgress 8.1.4 deadlocking??

2006-09-27 Thread Rafal Pietrak
Ups, missed the list recepient itself. Thenx Duncan for the analysis. This happend again, so I'm able to peek at the details you've pointed out. On Wed, 2006-09-27 at 09:33 -0700, Casey Duncan wrote: Sounds like it was blocked (unsure by what). You can use pg_locks to check that. That view

[GENERAL] time conversion fuinctions

2006-10-07 Thread Rafal Pietrak
Hi All, Is this the expected result? The question particularly apply to the last SELECT. I'd expected it to return boolean value just like in the second example below. It returns nothing instead, and does not rise an error either. Is this the correct behavior? But also, is it correct for a

Re: [GENERAL] time conversion fuinctions

2006-10-07 Thread Rafal Pietrak
On Sat, 2006-10-07 at 11:57 -0400, Tom Lane wrote: Rafal Pietrak [EMAIL PROTECTED] writes: Is this the expected result? timestamp_date() currently returns NULL if the timestamp is infinity. Since we don't have any representation for infinity in the date type, I understand, you mean

[GENERAL] predefined functions

2006-10-07 Thread Rafal Pietrak
Hi, Is there a reason why both: SELECT current_user; SELECT current_database(); are correct, while neither of: SELECT current_user(); -- syntax at '(' SELECT current_database; -- missing column is? This is as of postgres version 8.1.4 -- Rafal Pietrak

Re: [GENERAL] predefined functions

2006-10-08 Thread Rafal Pietrak
On Sun, 2006-10-08 at 01:44 -0400, Tom Lane wrote: Yeah: current_user (without the parens) is specified by the SQL standard, but we're not about to adopt such a brain-dead syntax for any of the functions defined by Postgres itself --- as you I see. One of committee's work gems :( And yet,

[GENERAL] adjusting primary key

2006-10-10 Thread Rafal Pietrak
Hi All, I have two tables: CREATE TABLE t1 (id int not null unique, info text); CREATE TABLE t2 (id int, grp int references t1(id), info text); Now, at certain point (both tables populated with tousends of records, and continuesly referenced by users), I need to adjust the value of an ID field

Re: [GENERAL] adjusting primary key

2006-10-10 Thread Rafal Pietrak
table on rows which have to be deleted or updated according to your changes in t1. For changing the existing table take a look at the ALTER TABLE commands. Greetings, Matthias -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rafal Pietrak Sent

[GENERAL] STABLE functions

2006-10-11 Thread Rafal Pietrak
Hi All, May be someone can help me with the following problem: 1. I need to extend 'featurs' of database user account. 2. I did that by creating a table: CREATE TABLE users (username text, -- key matching 'current_user' freaturs text -- thing I need ); 3. I allow acces to that table

Re: [GENERAL] STABLE functions

2006-10-11 Thread Rafal Pietrak
On Wed, 2006-10-11 at 10:30 -0400, Tom Lane wrote: 1. I used the STABLE keyword to tell executor to evaluate the function just once per statement. Wrong. STABLE is not a directive to the system, it is a promise about the behavior of your function ... and you're trying to break the

Re: [GENERAL] STABLE functions

2006-10-12 Thread Rafal Pietrak
On Thu, 2006-10-12 at 11:47 +0200, Martijn van Oosterhout wrote: What may have a better chance is assigning triggers to commands (like ON CREATE USER) which trigger on specific situations. No-one serious considered implementing this though, at it's unclear what the use-case would be anyway...

Re: [GENERAL] looping through query to update column

2006-10-13 Thread Rafal Pietrak
On Fri, 2006-10-13 at 09:23 +0200, Albe Laurenz wrote: You might use 'ctid' to identify the row if you have no suitable How should I use 'ctid'? Like in the case, when I've selected something by means of SELECT ... FOR UPDATE? -- -R ---(end of

[GENERAL] Data visibility

2006-10-15 Thread Rafal Pietrak
Hi, I'm trying to write a trigger function, that would update an 'associated' TEBLE on INSERT to master table: CREATE TABLE master (id int not null unique, info text, ); CREATE TABLE aux (master int references master(id), info text, ...); CREATE FUNCTION adjust() RETURNS trigger AS $$ BEGIN

Re: [GENERAL] Data visibility

2006-10-15 Thread Rafal Pietrak
On Sun, 2006-10-15 at 20:01 +0200, Rafal Pietrak wrote: new.id := 1000-old.id; Sory, correction. Of cource, this ID update looks more like the following (OLD.* isn't valid at this point): new.id := 1000 - new.id; -- -R ---(end of broadcast

Re: [GENERAL] Data visibility

2006-10-15 Thread Rafal Pietrak
On Sun, 2006-10-15 at 15:15 -0400, Tom Lane wrote: Well, of course not: it's a BEFORE trigger, so the row insertion hasn't actually happened yet. I think you need to split this operation into a BEFORE trigger that changes the ID, and an AFTER trigger that propagates the data into the other

Re: [GENERAL] Data visibility

2006-10-16 Thread Rafal Pietrak
On Sun, 2006-10-15 at 18:16 -0400, Tom Lane wrote: Rafal Pietrak [EMAIL PROTECTED] writes: Hmm. I tried that, But I'm stuck with finding a way to propagate the 'intermediate data' between BEFORE/AFTER triggers, *outside* of a TABLE structure. That data is easily accesable inside the BEFORE

Re: [GENERAL] A query planner that learns

2006-10-17 Thread Rafal Pietrak
On Tue, 2006-10-17 at 10:24 -0400, Madison Kelly wrote: Nor am I a lawyer, but I still hold that hoping ignorance will be a decent defense is very, very risky. In the end I am not a pgSQL developer so it isn't in my hands either way. If I may. The hoping, ignorance will save you line of

[GENERAL] A VIEW mimicing a TABLE

2006-12-13 Thread Rafal Pietrak
Hi, May be someone could help me with this: For some time now, I exercise the use of VIEWs to expose just the features of TABLES a particular user is supposed to see/have. I can see that with a VIEW, I can do prity mutch everything I can do with a TABLE, so a VIEW mimics a TABLE quite well

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-13 Thread Rafal Pietrak
On Wed, 2006-12-13 at 11:08 -0500, Tom Lane wrote: You can add a default to a view's column, either the same as the underlying table's default, or different if you want. ALTER TABLE view ALTER COLUMN col SET DEFAULT expr G! The obvious solutions are most difficult to spot. Thenx! -- -R

[GENERAL] about the RULE system

2006-12-13 Thread Rafal Pietrak
Hi All, This is something that bugs me for some time now. I have: (as user postgres I do) CREATE TABLE debi (id int, name text); REVOKE ALL ON debi FROM public; CREATE FUNCTION piti() RETURNS trigger AS $$ DECLARE me RECORD; BEGIN select * into me FROM pg_authid; new.id

Re: [GENERAL] about the RULE system

2006-12-13 Thread Rafal Pietrak
On Wed, 2006-12-13 at 14:01 -0500, Tom Lane wrote: Rafal Pietrak [EMAIL PROTECTED] writes: I thought trigger functions execute at root/postgres security level? No. You probably want to make that function SECURITY DEFINER so it executes as the owner, but this isn't default for triggers

Re: [GENERAL] about the RULE system

2006-12-13 Thread Rafal Pietrak
On Wed, 2006-12-13 at 15:43 -0600, Scott Marlowe wrote: On Wed, 2006-12-13 at 15:36, Rafal Pietrak wrote: REVOKE ALL ON FUNCTION piti() FROM PUBLIC Doe not seam to have any effect on functions installed as a trigger. Does your common user have the permission to create users

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread Rafal Pietrak
On Thu, 2006-12-14 at 08:01 -0200, William Leite Araújo wrote: On 12/13/06, Rafal Pietrak [EMAIL PROTECTED] wrote: CREATE RULE new_entry_notm AS ON INSERT to logview WHERE new.tm IS NULL DO INSTEAD INSERT (id,info) VALUES (new.id,new.info); CREATE RULE

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread Rafal Pietrak
On Thu, 2006-12-14 at 02:45 -0800, SunWuKung wrote: CREATE RULE new_entry AS ON INSERT to logview DO INSTEAD INSERT (id,tm,info) VALUES (COALESCE(new.id,[default]),COALESCE(new.tm ,[default]),COALESCE(new.info,[default])); what would [default] insert here? the default of the view or

Re: [GENERAL] about the RULE system

2006-12-14 Thread Rafal Pietrak
Looks like this thread have died away. But since this permission check looks like a security issue to me too, I'd really apreciate someones explanation on why it is not ... if it is not. But if it is a security leak I'd like to pass it over as bug report - so it does not disapear from sight. -R

Re: [GENERAL] Password strength requirements

2006-12-22 Thread Rafal Pietrak
On Fri, 2006-12-22 at 01:20 -0600, Bruno Wolff III wrote: On Thu, Dec 21, 2006 at 23:43:06 +0100, Tomasz Ostrowski [EMAIL PROTECTED] wrote: And everything I need would be very simple to do if there was an option to disable self-change of passwords for ordinary users. That seems like

[GENERAL] TRIGGER BEFORE INSERT

2007-01-08 Thread Rafal Pietrak
Hi All! I have some old piece of code, that worked two years ago (Postgres version 7.2, I think), but doesn't work within Postgres 8.1.4 now. The story is, that I have a trigger on a table (business day statistics), that is fired before insert; it updates another table (detailed transaction

Re: [GENERAL] TRIGGER BEFORE INSERT

2007-01-08 Thread Rafal Pietrak
: the standard requires different semantics); or it was accidental, and came as a side effect of some other changes. Any ideas? On Mon, 2007-01-08 at 09:15 -0500, Jerry Sievers wrote: Rafal Pietrak [EMAIL PROTECTED] writes: Hi All! I have some old piece of code, that worked two years ago

Re: [GENERAL] TRIGGER BEFORE INSERT

2007-01-09 Thread Rafal Pietrak
On Tue, 2007-01-09 at 10:44 -0500, Tom Lane wrote: Rafal Pietrak [EMAIL PROTECTED] writes: 1. either the new value of test_days.dnia as already present in the NEW row, is not visible to UPDATE test_utarg sub-statement of the same transaction. But earlier versions of Postgres did allow

Re: [GENERAL] TRIGGER BEFORE INSERT

2007-01-11 Thread Rafal Pietrak
On Tue, 2007-01-09 at 18:41 +0100, Rafal Pietrak wrote: On Tue, 2007-01-09 at 10:44 -0500, Tom Lane wrote: Rafal Pietrak [EMAIL PROTECTED] writes: 1. either the new value of test_days.dnia as already present in the NEW row, is not visible to UPDATE test_utarg sub-statement of the same

Re: [GENERAL] TRIGGER BEFORE INSERT

2007-01-11 Thread Rafal Pietrak
On Thu, 2007-01-11 at 15:10 +0100, Alban Hertroys wrote: Rafal Pietrak wrote: Hi! I'm re-posting this message again in hope someone would have a look at the case again. .. it's pending. You were given a solution; defer the foreign key constraint. Well. I were, but probably I'm

Re: [GENERAL] TRIGGER BEFORE INSERT

2007-01-11 Thread Rafal Pietrak
Perfect! Thenx! -R On Thu, 2007-01-11 at 12:26 -0800, Adrian Klaver wrote: On Thursday 11 January 2007 10:26 am, Rafal Pietrak wrote: On Thu, 2007-01-11 at 15:10 +0100, Alban Hertroys wrote: Rafal Pietrak wrote: Hi! I'm re-posting this message again in hope someone would have

[GENERAL] a JOIN on same table, but 'slided over'

2007-06-26 Thread Rafal Pietrak
Hi, I understand, that this is 'general SQL' question rather then 'general postgres'. But may be someone here could help me with it anyways. I have a *single* table: CREATE TABLE test (id int not null unique, thread int not null, info text); The ID, although unique, is not continues. A sample

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-26 Thread Rafal Pietrak
Marvelous! Thenx! -R On Tue, 2007-06-26 at 10:06 +0200, hubert depesz lubaczewski wrote: On 6/26/07, Rafal Pietrak [EMAIL PROTECTED] wrote: Is there an SQL construct to get it? select distinct on (t1.id) t1.*, t2.* from test t1 join test t2 on t2.id t1.id

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-26 Thread Rafal Pietrak
* 18°32'57.25N 73°56'25.42 E - Pune Sent from my BlackLaptop device On 6/26/07, Rafal Pietrak [EMAIL PROTECTED] wrote: Marvelous! Thenx! -R On Tue, 2007-06-26 at 10:06 +0200, hubert depesz lubaczewski wrote: On 6/26/07, Rafal

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-26 Thread Rafal Pietrak
: canceling statement due to user request postgres=# On 6/26/07, Rafal Pietrak [EMAIL PROTECTED] wrote: OK. Have tried this one looks like close to 6 times slower then the 'non-standard' phrase with 'distinct on'. On the small dataset

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-28 Thread Rafal Pietrak
] [EMAIL PROTECTED] gmail | hotmail | indiatimes | yahoo }.com 17°29'34.37N 78°30'59.76E - Hyderabad * 18°32'57.25N 73°56' 25.42 E - Pune Sent from my BlackLaptop device On 6/26/07, Rafal Pietrak [EMAIL PROTECTED] wrote

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-29 Thread Rafal Pietrak
Thank you All for this extensive help! BTW: google helps, once you know that the construct is called correlated subquery - there is no way to get an answer before one knows the question :) Thenx again! -R On Thu, 2007-06-28 at 23:23 +0530, Gurjeet Singh wrote: On 6/28/07, Alban Hertroys

[GENERAL] FUNCTION returns SETOF

2006-05-23 Thread Rafal Pietrak
Hi All, The original reason I tied FUNCTIONS is that I need to extend ROLE definition as stored within pg_authid system table, with some (more or less arbitrary) user preferencies profile. At this point, the task comes down to the point where I can imagine having an additional table

Re: [GENERAL] background triggers?

2006-05-23 Thread Rafal Pietrak
On Tue, 2006-05-23 at 15:56 +, Chris Browne wrote: The use that I have for this at the moment, and I can think of many other uses, is that I want to populate a statistics table each time that a table is updated. But the code to populate the table takes 10 seconds to run. I don't want

Re: [GENERAL] background triggers?

2006-05-24 Thread Rafal Pietrak
On Tue, 2006-05-23 at 13:01 -0400, Kenneth Downs wrote: Rafal Pietrak wrote: some other INSERT, return imediately if so, but turn into background for a long-lasting job if not. Rafal, I'm wondering why you want to do this. You may be fighting the framework. Yes, most probably. I'm

Re: [GENERAL] background triggers?

2006-05-24 Thread Rafal Pietrak
On Wed, 2006-05-24 at 13:36 +0200, Sim Zacks wrote: My understanding of Listen/Notify is that it is a completely disconnected process running on the database server. Yes. But In my particular case (and I presume, the intention of 'bacground triggers' is that) a programmer (like myself) is not

Re: [GENERAL] background triggers?

2006-05-24 Thread Rafal Pietrak
On Wed, 2006-05-24 at 07:41 -0400, Kenneth Downs wrote: Why not have the INSERT go to an inbox table, a table whose only job is to receive the data for future processing. Actually, it 'sort of' works that way. Your client code should mark all rows with a batch number as they go in. Then

Re: [GENERAL] background triggers?

2006-05-24 Thread Rafal Pietrak
On Wed, 2006-05-24 at 08:38 -0400, Kenneth Downs wrote: What web server and OS are you using? In linux/apache you can fork off a process that runs the SP and then detach from it. Actually it is linux/apache. Yes, I could do it that way, but eventually I've sattled for a cron job that

Re: [GENERAL] background triggers?

2006-05-24 Thread Rafal Pietrak
On Wed, 2006-05-24 at 09:46 -0400, Christopher Browne wrote: The world rejoiced as [EMAIL PROTECTED] (Rafal Pietrak) wrote: My impression was, that I get the next prompt after the procedure finishes, so it wouldn't be a solution. But if (2) applies, that is really it Frankly, it would

Re: [GENERAL] background triggers?

2006-05-25 Thread Rafal Pietrak
I'd like to propose a 'syntax/semantics' of such trigger: Triggers normally execute inside of a transaction. A COMMIT within a trigger could mean: do a fork: fork-1) return to the main and schedule COMMIT there, fork-2) continue in bacground. From the perspective of my earlier applications, it

Re: [GENERAL] background triggers?

2006-05-25 Thread Rafal Pietrak
On Thu, 2006-05-25 at 10:33 +0200, Thomas Hallgren wrote: Rafal Pietrak wrote: I'd like to propose a 'syntax/semantics' of such trigger: Triggers normally execute inside of a transaction. A COMMIT within a trigger could mean: do a fork: fork-1) return to the main and schedule

Re: [GENERAL] background triggers?

2006-05-25 Thread Rafal Pietrak
On Thu, 2006-05-25 at 10:21 +0200, Dawid Kuroczko wrote: On 5/25/06, Rafal Pietrak [EMAIL PROTECTED] wrote: I'd like to propose a 'syntax/semantics' of such trigger: Triggers normally execute inside of a transaction. A COMMIT within a trigger could mean: do a fork: fork-1) return

Re: [GENERAL] background triggers?

2006-05-25 Thread Rafal Pietrak
On Thu, 2006-05-25 at 11:29 +0200, Thomas Hallgren wrote: Rafal Pietrak wrote: consuming housekeeping. Like a cleanup - always succeeds, even if sometimes is not really necesary (like in case of main rolling-back). A somewhat limited use-case to form generic database functionality

Re: [GENERAL] background triggers?

2006-05-25 Thread Rafal Pietrak
On Thu, 2006-05-25 at 18:49 +0200, Florian G. Pflug wrote: Rafal Pietrak wrote: 'technical' need for him/her to create the server side proces *provided* hi/she can setup a job *within* the database server itself, and just go away. Well, exactly not being interested in the outcome is IMHO

Re: [GENERAL] background triggers?

2006-05-25 Thread Rafal Pietrak
On Thu, 2006-05-25 at 20:27 +0200, Dawid Kuroczko wrote: On 5/25/06, Rafal Pietrak [EMAIL PROTECTED] wrote: Here I'm just not interested in that procedure outcome: if it eventually COMMITED or ROLLED-BACK. But obviously I am interested in consistancy of database, when the detached procedure

Re: [GENERAL] Restricting access to rows?

2006-05-26 Thread Rafal Pietrak
Hi, Are there any plans to make CREATE USER local to a database? (as opposed to CLUSTER scope, as it is today) So that in such cases as Benjamin's, the ISP could satisfy customer requests by createing and handing over the new database instance within the managed cluster? Even with the

Re: [GENERAL] Restricting access to rows?

2006-05-26 Thread Rafal Pietrak
On Fri, 2006-05-26 at 10:25 -0400, Tom Lane wrote: There is the db_user_namespace configuration parameter, but it's a bit of an ugly kluge if you ask me ... Haven't noticed that. But a [EMAIL PROTECTED], still can create a [EMAIL PROTECTED] - so it's of no use for privilege separation. Pity.

Re: RES: [GENERAL] LDAP authentication

2006-05-26 Thread Rafal Pietrak
On Fri, 2006-05-26 at 17:38 +0200, Florian G. Pflug wrote: [EMAIL PROTECTED] wrote: Are you using windows or unix? On unix, postgresql can use pam We are using a mix of windows and unix+linux and I think PAM can not be used with windows. Am I right? Is there another way? Not that I

[GENERAL] db_user_namespace

2006-05-27 Thread Rafal Pietrak
Hi All, Having the new (as of rel 8.xx) ROLE system; whould it be a problem to implement a: GRANT/REVOKE CONNECT ON database TO/FROM role | PUBLIC; instead of current cludge of db_user_namespace? -- -R ---(end of broadcast)--- TIP 5:

[GENERAL] a row disapearing

2006-05-27 Thread Rafal Pietrak
Hi All, This is ambarasing, but I've just noticed the following (which looks inconsistant to inexperienced eye). Having a table: test= CREATE TABLE xxx (id int, info text); With some rows in it, I try: test= SELECT count(1) from xxx where id=1; count ---

Re: [GENERAL] a row disapearing

2006-05-27 Thread Rafal Pietrak
On Sat, 2006-05-27 at 14:06 -0400, Bruce Momjian wrote: Is this a feature, or a bug? And in fact, is there a construct to get both the count() and its selectors *in*case*, when the count is ZERO? All the above in postgres 8.1. It is supposed to work that way. In the first query, we

Re: [GENERAL] a row disapearing

2006-05-27 Thread Rafal Pietrak
On Sat, 2006-05-27 at 11:51 -0700, Richard Broersma Jr wrote: select count(xxx.id) as cnt, xxx.id, xxx_grp.id as grpid, xxx_grp.grp fromxxx right join xxx_grp on (xxx.id = xxx_grp.id) group by xxx.id, grpid, xxx_grp.grp order by xxx_grp.id;

Re: [GENERAL] a row disapearing

2006-05-29 Thread Rafal Pietrak
On Mon, 2006-05-29 at 12:32 +0200, Nis Jorgensen wrote: Rafal Pietrak wrote: But is there a way to achieve one row output with both the count() and its selector, when the ocunt is ZERO? SELECT dummy.id, count(xxx.id) FROM (SELECT :id as id FROM dual) as dummy LEFT JOIN xxx using (id) GROUP

[GENERAL] UTF-8 context of BYTEA datatype??

2006-05-29 Thread Rafal Pietrak
Hi! Within a UTF-8 encoded database, I have a table: CREATE TABLE pics (id serial not null unique, img bytea); The table is originally initialized with a set of IDs. Then I'm using perl-script to insert apropriate images by means of UPDATEing rows: --within my script called

Re: [GENERAL] UTF-8 context of BYTEA datatype??

2006-05-29 Thread Rafal Pietrak
On Mon, 2006-05-29 at 14:01 +0200, Martijn van Oosterhout wrote: How come the bytearea is *interpreted* as having encoding? Actually, it's not the bytea type that is being interpreted, it's the string you're sending to the server that is. Before you send bytea data in a query string, you

Re: [GENERAL] UTF-8 context of BYTEA datatype??

2006-05-30 Thread Rafal Pietrak
On Tue, 2006-05-30 at 09:05 -0700, [EMAIL PROTECTED] wrote: Did you try escaping the data: my $rc=$sth-bind_param(1, escape_bytea($imgdata), { pg_type = DBD::Pg::PG_BYTEA }); No. But: $ ./test Undefined subroutine main::escape_bytea called at ./test line 34. Where can I find one?

Re: [GENERAL] UTF-8 context of BYTEA datatype??

2006-05-30 Thread Rafal Pietrak
On Tue, 2006-05-30 at 20:12 +0200, Daniel Verite wrote: Rafal Pietrak wrote: Hmmm, despite initial euphoria, this doesn't actually work. Just an idea: make sure DBD::Pg::PG_BYTEA is defined. If not, you're just lacking a use DBD::Pg; and the result :) This time it's a hit. Thenx

Re: [GENERAL] UTF-8 context of BYTEA datatype??

2006-05-31 Thread Rafal Pietrak
On Tue, 2006-05-30 at 22:47 +0200, Martijn van Oosterhout wrote: That's why bytea need special encoding to get around this check. But may be you would know, why I should write: { pg_type = DBD::Pg::PG_BYTEA } instead of possibly more generic: { TYPE = SQL_BINARY } The later

Re: [GENERAL] UTF-8 context of BYTEA datatype??

2006-06-01 Thread Rafal Pietrak
opoque value - not interpretted in any way by the RDBMS (like: not converted according to clinet_encoding). In my opinion I meant SQL_BINARY. So if in the postresql RDMBS, there is no other datatype closer to the SQL_BINARY semantics, the PG_BYTEA should be just a synonym. -- Rafal Pietrak [EMAIL

[GENERAL] ALTER USER ..... PASSWORD ....

2006-06-06 Thread Rafal Pietrak
Just wondering, psql clinet tool loggs issued commands into ~/.psql_history, which is VERY usefull. I exercise grep-ing the file extensively. But when it comes to command like ALTER/CREATE USER ... PASSWORD I'd rather have it NOT logged. This is not a major issue, since there are workarounds -

Re: [GENERAL] ALTER USER ..... PASSWORD ....

2006-06-06 Thread Rafal Pietrak
. Obviously, psql is not a place for any extensive command filtering. But this touches security and I would be willing to have an exception here. Still, that's just my 2c. Regards, -R On Tue, 2006-06-06 at 10:07 -0400, Tom Lane wrote: Rafal Pietrak [EMAIL PROTECTED] writes: psql clinet tool

Re: [GENERAL] help with rules please

2006-06-07 Thread Rafal Pietrak
May be this is not a full explanation, but at least a recepiet, that works for me: CREATE TABLE testa (x1 text, x2 text); CREATE VIEW testb AS SELECT * from testa; CREATE RULE r0 AS ON INSERT TO testb DO INSTEAD INSERT INTO testa (x1,x2) VALUES (new.x1,new.x2); CREATE RULE r1 AS ON INSERT TO

Re: [GENERAL] Password for postgresql superuser?

2006-06-08 Thread Rafal Pietrak
On Thu, 2006-06-08 at 09:08 -0600, jqpx37 wrote: Sorry; I meant a password at the operating system level, not at the postgresql level. On my Linux system, without an OS level password, the only way to log in (in Linux) to the postgres account is by su'ing from root, which seems more

[GENERAL] using ROLE system

2006-07-12 Thread Rafal Pietrak
Hi All, I have a database where I give priviledges solely by user membership in permitted roles (groups). It works flowlessly, but when I tried to assign CREATEUSER priviledge to an administrator ROLE (just one database administrator, not the postmaster), I have to explicitly SET ROLE ADMIN

Re: [GENERAL] pgsql vs mysql

2006-07-12 Thread Rafal Pietrak
On Tue, 2006-07-11 at 15:24 -0500, Ron Johnson wrote: Joshua D. Drake wrote: It is also something that users are clammoring for (and my customers). To the point that I have customers using unions to emulate the behavior. Why? Because it is really, really fast. When inserting multiple

Re: [GENERAL] permission to create user

2006-07-18 Thread Rafal Pietrak
On Mon, 2006-07-17 at 07:54 -0400, John DeSoi wrote: On Jul 17, 2006, at 2:56 AM, Timothy Smith wrote: is it possible to give a non super user the ability to create another user of a different group? i'm looking for a way to assign a special group of admin's just enough rights to

Re: [GENERAL] permission to create user

2006-07-18 Thread Rafal Pietrak
On Tue, 2006-07-18 at 07:31 -0600, Michael Fuhr wrote: On Tue, Jul 18, 2006 at 01:45:01PM +0200, Rafal Pietrak wrote: Any one knows, why do I have to explicitly SET ROLE, when I try to exercise the group priviledge of role creation, while I don't need that when accessing tables

Re: [GENERAL] permission to create user

2006-07-18 Thread Rafal Pietrak
it. http://www.postgresql.org/docs/8.1/interactive/sql-createfunction.html John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings -- Rafal

[GENERAL] use of index

2006-07-30 Thread Rafal Pietrak
. But I'm not able to reproduce the seq-scan on the freshly created table, which is *identical* to TABLE ludzie. On the other hand, I have REINDEXED the database, to no avail. ludzie(username) is still seq-scanned. Any ideas? -- Rafal Pietrak [EMAIL PROTECTED] ---(end

Re: [GENERAL] use of index

2006-07-31 Thread Rafal Pietrak
On Mon, 2006-07-31 at 12:55 +1000, Chris wrote: Rafal Pietrak wrote: strop=# EXPLAIN ANALYZE SELECT * from users where username = current_user; QUERY PLAN

[GENERAL] CREATE DATABASE

2006-08-03 Thread Rafal Pietrak
Hi All, I'd like to cast a small 'feature request' here for discussion/ evaluation. The case is the following: When working on a new database application I quite frequently: --- test_xx# \c template1 template1# DROP DATABASE test_xx; template1#

Re: [GENERAL] CREATE DATABASE

2006-08-03 Thread Rafal Pietrak
On Thu, 2006-08-03 at 18:07 +0100, Richard Huxton wrote: Rafal Pietrak wrote: When working on a new database application I quite frequently: --- test_xx# \c template1 template1# DROP DATABASE test_xx; template1# CREATE DATABASE test_xx TEMPLATE

Re: [GENERAL] CREATE DATABASE

2006-08-04 Thread Rafal Pietrak
On Fri, 2006-08-04 at 00:44 +0400, Nikolay Samokhvalov wrote: But the logic is clear, isn't it? Connection is not client operation. I think that Rafal's proposal is quite interesting (I experience the same difficulties every time. There was several wrong DROP DATABASE in my career... :-) )

[GENERAL] multimpe records output from a 'no-table' source

2006-08-25 Thread Rafal Pietrak
Hi all, There is this functions like 'current_date', 'current_database', etc. yielding a row of data without any table to source rows from. Like: dev=# SELECT current_date; date 2006-08-25 (1 row) Is there a way to get multiple rows?

Re: [GENERAL] multimpe records output from a 'no-table' source

2006-08-25 Thread Rafal Pietrak
On Fri, 2006-08-25 at 08:02 +0200, Martijn van Oosterhout wrote: For the rest of your question, see generate_series(); http://www.postgresql.org/docs/8.1/static/functions-srf.html Thenx, That's exactly what I've needed! -- -R ---(end of

[GENERAL] optimising UNION performance

2006-08-28 Thread Rafal Pietrak
Hi all, Is there a way to speed up the query to my 'grand total' logfile, constructed as a UNION of smaller (specialised) logfiles? Access to log1/log2 is quick (If I'm reading ANALYSE log correctly, it's c.a. 100ms each - and it feels like that, so presumebly I'm reading ANALYSE just OK), but

Re: [GENERAL] optimising UNION performance

2006-08-28 Thread Rafal Pietrak
=20484 width=26) (actual time=0.044..127.301 rows=20484 loops=1) Total runtime: 822.901 ms (7 rows) - On Mon, 2006-08-28 at 09:11 +, Ragnar wrote: On mán, 2006-08-28 at 10:23 +0200, Rafal Pietrak wrote: Hi all, Is there a way to speed up the query

Re: [GENERAL] optimising UNION performance

2006-08-28 Thread Rafal Pietrak
On Mon, 2006-08-28 at 13:04 +0200, Alban Hertroys wrote: Rafal Pietrak wrote: Total runtime: 822.901 ms (7 rows) - Just to make sure: You do have an appropriate index over the tables in that UNION? Well. The logfiles don't have their own indexes

Re: [GENERAL] optimising UNION performance

2006-08-28 Thread Rafal Pietrak
On Mon, 2006-08-28 at 14:50 +0200, Alban Hertroys wrote: Rafal Pietrak wrote: But when I look at ANALYSE output of comlog SELECT, I can see, that: 1. the seq-scans is more expensive here: 170ms and 120ms respectively. Any reasons for that? 2. each scan has an additional job of: Subquery

Re: [GENERAL] optimising UNION performance

2006-08-28 Thread Rafal Pietrak
This is a little strange - my response to this post apparently got lost in the net?? I haven't received it back through the list nor it's visible in the archieve. Yet, my exim logfile contains entry indicating 'delivery complited'??? But to the point. All the EXPLAIN ANALISE I did on posggres

[GENERAL] a performence question

2008-09-04 Thread Rafal Pietrak
Hi, Maybe someone on this list actually have already tried this: I'm planning to make a partitioned database. From Postgres documentation I can see, that there are basically two methods to route INSERTS into partitioned table: one. is a TRIGGER other. is a RULE My Table will

Re: [GENERAL] a performence question

2008-09-07 Thread Rafal Pietrak
be immensely simpler. And thenx again for the help in evaluating the routing performance. This helped me a lot! -R On Fri, 2008-09-05 at 17:04 +0200, Filip Rembiałkowski wrote: 2008/9/4 Rafal Pietrak [EMAIL PROTECTED]: Hi, Maybe someone on this list actually have already tried

[GENERAL] sequences and RULEs

2009-06-05 Thread Rafal Pietrak
Hi All! I've seen sometning unexpected here. I'd apreciate it if someone could give me a hint of why this have happened and may be a sugesstion of a workaround. I'm writing Building Access Control System (BACS). My environment is Debian testing with their current postgresql version: 8.3.7. I my

Re: [GENERAL] sequences and RULEs

2009-06-05 Thread Rafal Pietrak
On Fri, 2009-06-05 at 14:32 +0100, Richard Huxton wrote: Rafal Pietrak wrote: The NEW tuple of the table EVENTLOG, in its ID field at the moment of RULE execution has a value of 5! But after everything is finished, the actual value deposited in that record is 4. A rule rewrites the query

[GENERAL] INSERT-colision/MERGE in postgresql

2011-08-14 Thread Rafal Pietrak
Hi, I've recently looked into the problem of my INSERTs throwing an ROW error, when a new row hits an already present one, by unique constraint. It triggers an expensive rollback, and I'd like to have it sort of optimised. In my case, duplicates can be discarded on an attempt INSERT, but an

[GENERAL] why VOLATILE attribute is required?

2011-09-22 Thread Rafal Pietrak
Hi All, I have this function: CREATE FUNCTION mypass(newpass text) returns text EXECUTE 'ALTER USER ' || quote_ident(session_user) || ' PASSWORD ' || quote_literal(newpass); return session_user::text; to varify user passwords before allowing a change. I've put that function in a RULE that

Re: [GENERAL] why VOLATILE attribute is required?

2011-09-22 Thread Rafal Pietrak
On Thu, 2011-09-22 at 07:50 -0500, Merlin Moncure wrote: On Thu, Sep 22, 2011 at 5:28 AM, Rafal Pietrak ra...@zorro.isa-geek.com wrote: if you change the state of the database, including (and especially) system catalogs, your function is volatile, period. Hmmm. To quote from the online

Re: [GENERAL] why VOLATILE attribute is required?

2011-09-22 Thread Rafal Pietrak
On Thu, 2011-09-22 at 16:57 +0200, Szymon Guz wrote: On 22 September 2011 16:29, Rafal Pietrak ra...@zorro.isa-geek.com wrote: [--] Well. In this caase, I'd like it being optimised away. This is the expected result. And the above documentation

[GENERAL] a dumb question regarding RULES

2011-10-10 Thread Rafal Pietrak
Hi all, I've been using RULES for some time now, and despite the fact, that I always had to make experiments to have the expected results, it worked for me just fine. Now I have this simple scenario: --- mbr2=# CREATE TEMP TABLE test(a int, b

Re: [GENERAL] a dumb question regarding RULES

2011-10-10 Thread Rafal Pietrak
On Mon, 2011-10-10 at 16:48 +0200, hubert depesz lubaczewski wrote: On Mon, Oct 10, 2011 at 04:06:34PM +0200, Rafal Pietrak wrote: Hi all, first of all - why did you send this mail as reply to some 2-weeks old thread, instead of just start of new thread? Sorry for that. Old habits

[GENERAL] how to make an SQL UPDATE from record returning function

2012-04-24 Thread Rafal Pietrak
Hi all, Recently I have fell onto a multicolumn update problem, earlier discussed here: http://postgresql.1045698.n5.nabble.com/UPDATE-of-several-columns-using-SELECT-statement-td1916045.html But in my case, subselect does not help, since in my case, new values for a row I get from an output of

Re: [GENERAL] how to make an SQL UPDATE from record returning function

2012-04-24 Thread Rafal Pietrak
On Tue, 2012-04-24 at 02:48 -0500, Abel Abraham Camarillo Ojeda wrote: [] Why don't create table my_table which stores the composite value by itself (not in two parts)? Hmmm. OK. mea coulpa. I didn't follow the SQL good practice, and I don't have a unique ID column in

Re: [GENERAL] how to make an SQL UPDATE from record returning function

2012-04-25 Thread Rafal Pietrak
On Tue, 2012-04-24 at 12:10 +0200, Thomas Kellerer wrote: Rafal Pietrak, 24.04.2012 09:02: is not an option, since the function is *very* expensive (multiple join of large tables - inventories, history, etc). Is there a syntax workaround that I could possibly use to get the effect

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-19 Thread Rafal Pietrak
On Tue, 2012-06-19 at 19:06 +0800, Craig Ringer wrote: On 06/19/2012 02:20 PM, Tom Lane wrote: So you're suggesting that SELECT 1/0; should terminate a transaction, but SELECT 1//0; should not? How about ROLBACK;? It gets pretty squishy pretty fast when you try to decide which sorts of

  1   2   >