Re: [GENERAL] extend sql?

2006-01-12 Thread Qingqing Zhou
""xiapw"" <[EMAIL PROTECTED]> wrote > Hello everyone,I want to konw how to extend the SQL. > For example,Create table temp [sec_level],sec_level means the secure level > of the table that you have created,how to do this? If you mean extend the SQL grammar, modify file backend/parser/gram.y. Reg

[GENERAL] extend sql?

2006-01-12 Thread xiapw
Hello everyone,I want to konw how to extend the SQL. For example,Create table temp [sec_level],sec_level means the secure level of the table that you have created,how to do this? xiapw

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Tom Lane
"Qingqing Zhou" <[EMAIL PROTECTED]> writes: > Maybe related question: is the code below in XactLockTableWait() related to > SIGQUIT? No. > /* > * Transaction was committed/aborted/crashed - we have to update pg_clog > * if transaction is still marked as running. > */ > if (!TransactionId

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Qingqing Zhou
"Tom Lane" <[EMAIL PROTECTED]> wrote > > The key word there is "safely". We don't have a lot of trust in > SIGTERM'ing individual backends (as opposed to shutting down the > whole cluster at once, which is a well-tested code path). See the > archives. > Maybe related question: is the code below

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Chris Browne
[EMAIL PROTECTED] ("Mikael Carneholm") writes: >>"Built In" Failover/Clustering > >>This won't happen. The community stance, which is a good one is that >>no single replication solutions fits everyone's needs and therefore >>we rely out the outside sources. Slony-I, Mammoth Replicator and >>pgpool

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Harry Jackson
On 1/12/06, Jeff Trout <[EMAIL PROTECTED]> wrote: > > On Jan 12, 2006, at 1:36 PM, Joshua D. Drake wrote: > > >>> "Built In" Failover/Clustering > >>> This won't happen. The community stance, which is a good one is > >>> that no single replication solutions fits everyone's needs and > >>> therefore

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Doug McNaught
Jeff Trout <[EMAIL PROTECTED]> writes: > Isn't the [expensive db name here]'s replication/failover just an > expensive addon? > As in if you don't pay for it you don't get it. > > So we're basically in the same boat as them.. just an add on. we just > offer more variety. Well, [cheap and crappy o

Re: [GENERAL] MAX without FROM

2006-01-12 Thread Angshu Kar
Thanks Scott. I've used another way of getting the max - I've used order by desc in my inner query and selected top 1 to get the max value ...On 1/12/06, Scott Marlowe <[EMAIL PROTECTED]> wrote: On Thu, 2006-01-12 at 13:14, Angshu Kar wrote:> What are 1 ,2 and 3 in your query?>> Here is my inner q

Re: [GENERAL] MAX without FROM

2006-01-12 Thread Scott Marlowe
On Thu, 2006-01-12 at 13:14, Angshu Kar wrote: > What are 1 ,2 and 3 in your query? > > Here is my inner query which returns a set of min values. I want to > get the max out of the returned mean values... > > select min(evalue) as M from distance where query_id > in (select entry_id from partiti

Re: [GENERAL] MAX without FROM

2006-01-12 Thread Angshu Kar
What are 1 ,2 and 3 in your query?Here is my inner query which returns a set of min values. I want to get the max out of the returned mean values...select min(evalue) as M from distance where query_id in (select entry_id from partition where partition = 849) On 1/12/06, Scott Marlowe <[EMAIL PROT

Re: [GENERAL] MAX without FROM

2006-01-12 Thread Scott Marlowe
On Thu, 2006-01-12 at 12:58, Angshu Kar wrote: > Hi, > > Can I use Select max(a field returned from another query)? > say, another query returns say 10,1,2,3,6,7 Does this form help you: select max(a) from (select 1 as a union select 2 union select 3) as b; ---(end of b

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Jeff Trout
On Jan 12, 2006, at 1:36 PM, Joshua D. Drake wrote: "Built In" Failover/Clustering This won't happen. The community stance, which is a good one is that no single replication solutions fits everyone's needs and therefore we rely out the outside sources. Slony-I, Mammoth Replicator and pgpool

[GENERAL] MAX without FROM

2006-01-12 Thread Angshu Kar
Hi,Can I use Select max(a field returned from another query)?say, another query returns say 10,1,2,3,6,7 Thanks,AK-- Ignore the impossible but honor it ...The only enviable second position is success, since failure always comes first...

Re: [GENERAL] Security implications of untrusted triggers

2006-01-12 Thread Tom Lane
Joshua Kramer <[EMAIL PROTECTED]> writes: > I am writing a couple of Perl modules that talk to the outside world: one > talks to a database (via DBI), and one talks to a Jabber/XMPP server. I > want to use these from within a Trigger. This is most likely a bad idea for reasons that have nothing

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Tom Lane
Tino Wildenhain <[EMAIL PROTECTED]> writes: >> * Allow administrators to safely terminate individual sessions either via an >> SQL function or SIGTERM > I thought this already works? At least I'm doing so when I need ... > (SIGTERM) The key word there is "safely". We don't have a lot of trust i

Re: [GENERAL] Large object restore problem w/triggers

2006-01-12 Thread Tom Lane
Claire McLister <[EMAIL PROTECTED]> writes: > Thanks for your quick response. Sorry for the omission, the PG > version is 7.4.8 > How do I temporarily disable the trigger while doing the restore? > Should I remove the trigger, do the dump, and then work from there? Yeah, it looks like that's

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Tino Wildenhain
Chris Browne schrieb: > From the ToDo list... > > http://www.postgresql.org/docs/faqs.TODO.html > > * Allow administrators to safely terminate individual sessions either via an > SQL function or SIGTERM I thought this already works? At least I'm doing so when I need ... (SIGTERM) -

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Joshua D. Drake
Mikael Carneholm wrote: In terms of statistics we do have statistics and exhaustive logging that can provide you with all of that information. Is there something specific that the information already provided really doesn't give you? Can you give an example query for "list all queries execute

[GENERAL] Security implications of untrusted triggers

2006-01-12 Thread Joshua Kramer
Or more specifically, what are the security implications of a trigger written in an untrusted language - PL/PerlU? With a standard stored procedure, you have the possibility of an SQL-injection attack. Is this possible with a trigger function, if it is defined as a trigger? I am writing a

Re: [GENERAL] Large object restore problem w/triggers

2006-01-12 Thread Claire McLister
Thanks for your quick response. Sorry for the omission, the PG version is 7.4.8 How do I temporarily disable the trigger while doing the restore? Should I remove the trigger, do the dump, and then work from there? It's difficult to move to 8.1 right now, so I'd prefer a workaround if we c

Re: [GENERAL] Large object restore problem w/triggers

2006-01-12 Thread Tom Lane
Claire McLister <[EMAIL PROTECTED]> writes: > We have a database with a bunch of large objects, who's ids we > reference in a table. There is a trigger associated with inserts and > updates on the table to delete the old value when inserting a new > large object associated with a row in the

[GENERAL] Large object restore problem w/triggers

2006-01-12 Thread Claire McLister
Hi, We have a database with a bunch of large objects, who's ids we reference in a table. There is a trigger associated with inserts and updates on the table to delete the old value when inserting a new large object associated with a row in the table. This causes a problem when doing a p

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Chris Browne
>From the ToDo list... http://www.postgresql.org/docs/faqs.TODO.html * Allow administrators to safely terminate individual sessions either via an SQL function or SIGTERM * Add SQL99 WITH clause to SELECT * Add SQL99 WITH RECURSIVE to SELECT * Create a bitmap of pages that need vacuuming -- outp

Re: [GENERAL] Issue with fixseq.sql in 8.1 release notes

2006-01-12 Thread Tom Lane
"George Woodring" <[EMAIL PROTECTED]> writes: > I was running fixseq.sql copied from the release notes to up date the > sequences and the output has an extra "\" character Now how'd that happen? I *know* I tested that code when I put it into the release notes ... but it's sure wrong ... thanks fo

Re: [GENERAL] sql (Stored procedure) design question

2006-01-12 Thread Assad Jarrahian
Alban and Tino, More explanations lie below. A document contains to field, from field, subject, message, etc > >>documentid,username,groupname (as real fields) > No, it would look like this: > > (1,'jarraa','postgres','keith') to match your original schema. I dont understand it. what type would

[GENERAL] Locales problems with debian sarge3.1

2006-01-12 Thread Amédée
Hello, I saw lot of topics treating about the subject, but nowhere i found real solutions. Has the bug been fixed? # set > LANG=fr_FR LANGUAGE=fr_FR:fr LC_ALL=C LC_MESSAGES=C Before initialising DB I fixed these variables : (I don't use -E option of initdb) export LC_ALL=C export LANG="fr_FR

Re: [GENERAL] cursors as table sources

2006-01-12 Thread Michael Fuhr
[Please copy the mailing list on replies. I'm forwarding your entire message to the list without comment so others can see it; I'll look at it when I get a chance.] On Thu, Jan 12, 2006 at 04:21:04PM +0200, Peter Filipov wrote: > It is the second case. > > I find cursors as good way to pass a re

Re: [GENERAL] Finding orphan records

2006-01-12 Thread Wes
On 1/12/06 10:37 AM, "Greg Stark" <[EMAIL PROTECTED]> wrote: > If it's only a factor of 3-4 then the merge join should be faster. If it's > really two orders of magnitude (100x?) then the nested loop below would be > faster. I think in 8.1 (and I think in 8.0 too) the planner is capable of > comin

Re: [GENERAL] Returning SQL statement

2006-01-12 Thread codeWarrior
You might want to consider an inheritance model for this I use it for Sarbanes-Oxley and a viurtual rollback system... http://www.postgresql.org/docs/8.0/interactive/tutorial-inheritance.html "rlee0001" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I want to write a row-leve

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Mikael Carneholm
>In terms of statistics we do have statistics and exhaustive logging that >can provide you with all of that information. Is there something >specific that >the information already provided really doesn't give you? Can you give an example query for "list all queries executed since 12.00 AM, orde

Re: [GENERAL] Finding orphan records

2006-01-12 Thread Greg Stark
Wes <[EMAIL PROTECTED]> writes: > This appears to be very inefficient. B is almost two orders of magnitude > larger than A. C is about 3-4 times as big as B (record count). My > statement (with the same single 'B' table as above) produces: If it's only a factor of 3-4 then the merge join shou

Re: [GENERAL] Plans for 8.2?

2006-01-12 Thread Joshua D. Drake
Mikael Carneholm wrote: Hi, I wonder what features other users would like to see in the next version? (8.2) The features I'd (very much) would like to see implemented are: - "Top offender statistics" In other DBMS:es there are functions that allow you to turn on a sort of monitoring that can

[GENERAL] Plans for 8.2?

2006-01-12 Thread Mikael Carneholm
Hi, I wonder what features other users would like to see in the next version? (8.2) The features I'd (very much) would like to see implemented are: - "Top offender statistics" In other DBMS:es there are functions that allow you to turn on a sort of monitoring that can tell you, for a period of

Re: [GENERAL] sql (Stored procedure) design question

2006-01-12 Thread Tino Wildenhain
Assad Jarrahian schrieb: > Tino, thanks for your response > >>Your schema could rather look like this: >> >>documentid,username,groupname (as real fields) >> > > > Okay, so a typical document can be addressed to any number of users/groups. > so > according to an example with the to field = 'j

Re: [GENERAL] select into multiple variables

2006-01-12 Thread SunWuKung
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > I have a select statement in a pgpsql function that returns two columns > and a single row. > I would like to place the two values into two variables in a single > statement, but so far I couldn't find out what is the syntax for that. >

[GENERAL] select into multiple variables

2006-01-12 Thread SunWuKung
I have a select statement in a pgpsql function that returns two columns and a single row. I would like to place the two values into two variables in a single statement, but so far I couldn't find out what is the syntax for that. I tried a couple of combinations of this but had no luck: SELECT I

Re: [GENERAL] regarding triggers

2006-01-12 Thread John McCawley
surabhi.ahuja wrote: but if i have "on delete cascade" constraint, in that case if i have a trigger which is fired in case delet happens on the table y. i have a table x, and table y has a foreign key with "on delete cascade" constraint, now i delete a row from x, will the trigger still

[GENERAL] Issue with fixseq.sql in 8.1 release notes

2006-01-12 Thread George Woodring
I have install 8.1.2 on my test box and loaded data from a 7.4.8 database. I was running fixseq.sql copied from the release notes to up date the sequences and the output has an extra "\" character ALTER TABLE public.modems_old ALTER COLUMN modemsid SET DEFAULT nextval\('modems_id'); To fix it

Re: [GENERAL] Granting Privleges on All Tables in One Comand?

2006-01-12 Thread Larry Rosenman
Tom Lane wrote: > Bruce Momjian writes: >> Adam wrote: >>> Is it possible to 'GRANT SELECT ON ALL TABLES TO User' in 1 command >>> ? >>> >>> I saw the question in 2003 and wonder if it's still true. > >> Still true, but on the TODO list: > > Also, you can do it today by making a plpgsql functi

Re: [GENERAL] Returning SQL statement

2006-01-12 Thread A. Kretschmer
am 11.01.2006, um 14:57:42 -0800 mailte rlee0001 folgendes: > I want to write a row-level trigger in PL/PGSQL that inserts rows into > an audit log whenever records are UPDATEd for a specific table. In my > audit log I want to record: Why do you want to reivent the wheel? http://pgfoundry.org/pro

Re: [GENERAL] Returning SQL statement

2006-01-12 Thread Jim Buttafuoco
take a look at dblink in the contrib directory, it has a function called dblink_current_query() that returns the current query. I use it all the time. Jim -- Original Message --- From: "rlee0001" <[EMAIL PROTECTED]> To: pgsql-general@postgresql.org Sent: 11 Jan 2006 14:57:42 -

Re: [GENERAL] Suse Linux 10.0

2006-01-12 Thread Jerome Lyles
On Sunday 08 January 2006 06:36, John Meyer wrote: > Jerome Lyles wrote: > > On Thursday 05 January 2006 10:57, Peter Eisentraut wrote: > >> Am Donnerstag, 5. Januar 2006 21:15 schrieb Joseph M. Day: > >>> Has anyone been able to get the latest version of Postgres working on > >>> Suse 10.0 ? I jus

[GENERAL] Returning SQL statement

2006-01-12 Thread rlee0001
I want to write a row-level trigger in PL/PGSQL that inserts rows into an audit log whenever records are UPDATEd for a specific table. In my audit log I want to record: * The primary key of the record being modified (easy) * The current date (easy) * The username of the user (easy) * The SQL state

[GENERAL] Concept about stored procedures

2006-01-12 Thread Marcos
Hi, I'm developing one application using this wonderful Database, and I've like of use the concepts correctly. Then, i decided that all my SQL statements will be in database using the procedure language (plpgsql or plpython), I go create functions for all interactions in database, and use in the

Re: [GENERAL] regarding triggers

2006-01-12 Thread surabhi.ahuja
Title: RE: [GENERAL] regarding triggers but if i have "on delete cascade" constraint, in that case if i have a trigger which is fired in case delet happens on the table y. i have a table x, and table y has a foreign key with  "on delete cascade" constraint, now i delete a row from x, will

Re: [GENERAL] sql (Stored procedure) design question

2006-01-12 Thread Alban Hertroys
Assad Jarrahian wrote: what drove me to store it that way was more of a performance issue. So if I store a documentID and then have a seperate table names, to_field Why a seperate table? From what you showed us you don't seem to need that. Just use 3 columns for the seperate entries instead o

Re: [GENERAL] sql (Stored procedure) design question

2006-01-12 Thread Assad Jarrahian
Tino, thanks for your response > > Your schema could rather look like this: > > documentid,username,groupname (as real fields) > Okay, so a typical document can be addressed to any number of users/groups. so according to an example with the to field = 'jarraa, postgres, keith', some rows could b