Re: [HACKERS] Can I check if somebody is superuser in stored procedure?

2011-03-27 Thread Pavel Stehule
Hello 2011/3/28 David Fetter : > On Sun, Mar 27, 2011 at 03:21:18PM +0200, Pavel Stehule wrote: >> Hello >> >> Is there some simple possibility to check a rights from stored procedure? > > Well, there's the catalog lookup method: > > SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_roles WHERE rolname=$

Re: [HACKERS] GSoC 2011 - Mentors? Projects?

2011-03-27 Thread Guillaume Lelarge
Le 26/03/2011 02:43, Tomas Vondra a écrit : > Dne 26.3.2011 02:05, Joshua Berkus napsal(a): >> Tomas, >> >>> I spoke to a teacher from a local university last week, mainly as we >>> were looking for a place where a local PUG could meet regularly. I >>> realized this could be a good opportunity to h

Re: [HACKERS] Problem with streaming replication, backups, and recovery (9.0.x)

2011-03-27 Thread Fujii Masao
On Sat, Mar 26, 2011 at 5:31 AM, hubert depesz lubaczewski wrote: > I can also setup streaming slave, and it also works, but when I create > trigger file to promote this slave to master it fails with error: > 2011-03-24 21:01:58.051 CET @ 9680  LOG:  trigger file found: > /home/depesz/slave2/fini

Re: [HACKERS] Comments on SQL/Med objects

2011-03-27 Thread Robert Haas
On Mon, Mar 28, 2011 at 12:06 AM, Tom Lane wrote: > Robert Haas writes: >> On Wed, Mar 23, 2011 at 12:53 PM, Tom Lane wrote: >>> Yeah, I had a private TODO about that.  I'd like to see if we can >>> refactor the grammar to eliminate some of the duplication there >>> as well as the potential for

Re: [HACKERS] Comments on SQL/Med objects

2011-03-27 Thread Tom Lane
Robert Haas writes: > On Wed, Mar 23, 2011 at 12:53 PM, Tom Lane wrote: >> Yeah, I had a private TODO about that.  I'd like to see if we can >> refactor the grammar to eliminate some of the duplication there >> as well as the potential for oversights of this sort.  I believe >> that USER MAPPINGs

Re: [HACKERS] Comments on SQL/Med objects

2011-03-27 Thread Robert Haas
On Wed, Mar 23, 2011 at 12:53 PM, Tom Lane wrote: > Robert Haas writes: >> On Tue, Mar 22, 2011 at 6:23 PM, Guillaume Lelarge >> wrote: >>> While working on adding support for SQL/Med objects to pgAdmin, I'm >>> quite surprised to see there is no way to add comments to SQL/Med >>> objects. Is th

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Tom Lane
Greg Stark writes: > I like all of: > 1) move the truncating to a new transaction just like we currently do > toast tables in a separate transaction from the main vacuum. +1 if we are going to continue the behavior of allowing other transactions to kick autovac off the exclusive lock. However,

Re: [HACKERS] Re: [COMMITTERS] pgsql: Fix plpgsql to release SPI plans when a function or DO block is

2011-03-27 Thread Tom Lane
David Fetter writes: > On Sun, Mar 27, 2011 at 04:51:13PM +, Tom Lane wrote: >> Fix plpgsql to release SPI plans when a function or DO block is freed. > Do the other PLs we ship need similar fixes? Offhand I think the other PLs leave management of prepared plans to the user. If there are an

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Tom Lane
Robert Haas writes: > On Sun, Mar 27, 2011 at 3:25 PM, Jan Wieck wrote: >> Since we are talking about stable releases, I think just releasing and >> reacquiring the exclusive lock is enough. We can then try to further improve >> things for future releases. > That seems unsafe - things can change

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Robert Haas
On Sun, Mar 27, 2011 at 9:41 PM, Jan Wieck wrote: > On 3/27/2011 6:21 PM, Robert Haas wrote: >> >> On Sun, Mar 27, 2011 at 3:25 PM, Jan Wieck  wrote: >>> >>>  Since we are talking about stable releases, I think just releasing and >>>  reacquiring the exclusive lock is enough. We can then try to fu

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Jan Wieck
On 3/27/2011 6:21 PM, Robert Haas wrote: On Sun, Mar 27, 2011 at 3:25 PM, Jan Wieck wrote: Since we are talking about stable releases, I think just releasing and reacquiring the exclusive lock is enough. We can then try to further improve things for future releases. That seems unsafe - thi

Re: [HACKERS] [DOCS] patch for createdb section in tutorial

2011-03-27 Thread Robert Haas
On Sun, Mar 27, 2011 at 6:41 AM, Susanne Ebrecht wrote: > Hello, > > During translating the docs I found the following sentence > in the tutorial section about createdb: > > "Database names must have an alphabetic first character > and are limited to 63 characters" > > I wondered - really characte

Re: [HACKERS] race condition in sync rep

2011-03-27 Thread Robert Haas
On Sun, Mar 27, 2011 at 7:46 AM, Simon Riggs wrote: > Are the master and standby on same system or are they separated by a network? > > I'm surprised that a network roundtrip takes less time than the > backend takes to mark clog and then queue for the SyncRepLock. When I first noticed that it was

Re: [HACKERS] Additional options for Sync Replication

2011-03-27 Thread Greg Stark
On Sun, Mar 27, 2011 at 10:45 PM, Simon Riggs wrote: > I was hoping to fine tune/tweak Sync Rep after feedback during beta, > but my understanding of current consensus is that that will be too > late to make user visible changes. So I'm proposing this change now, > before Beta, rather than during

Re: [HACKERS] Additional options for Sync Replication

2011-03-27 Thread Robert Haas
On Sun, Mar 27, 2011 at 5:45 PM, Simon Riggs wrote: > I was hoping to fine tune/tweak Sync Rep after feedback during beta, > but my understanding of current consensus is that that will be too > late to make user visible changes. So I'm proposing this change now, > before Beta, rather than during B

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Robert Haas
On Sun, Mar 27, 2011 at 3:25 PM, Jan Wieck wrote: > Since we are talking about stable releases, I think just releasing and > reacquiring the exclusive lock is enough. We can then try to further improve > things for future releases. That seems unsafe - things can change under you while you don't h

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Greg Stark
On Sun, Mar 27, 2011 at 8:25 PM, Jan Wieck wrote: > > Since we are talking about stable releases, I think just releasing and > reacquiring the exclusive lock is enough. We can then try to further improve > things for future releases. I like all of: 1) move the truncating to a new transaction jus

Re: [HACKERS] Can I check if somebody is superuser in stored procedure?

2011-03-27 Thread David Fetter
On Sun, Mar 27, 2011 at 03:21:18PM +0200, Pavel Stehule wrote: > Hello > > Is there some simple possibility to check a rights from stored procedure? Well, there's the catalog lookup method: SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_roles WHERE rolname=$1 AND rolsuper) Is that what you had in m

[HACKERS] Additional options for Sync Replication

2011-03-27 Thread Simon Riggs
Proposed changes: Make synchronous_replication into an enum, so we can now also say synchronous_replication = recv, flush or apply as well as on or off. synchronous_replication = on is the same as "flush" Benefit: Allows 2 additional wait modes for sync rep: wait for receive and wait for apply.

Re: [HACKERS] Open issues for collations

2011-03-27 Thread Martijn van Oosterhout
On Sun, Mar 27, 2011 at 03:14:37PM -0400, Tom Lane wrote: > > So the result of a cast would be the collation of the specified > > type/domain with state implicit. > > Hm. That makes sense for explicit CAST syntax, but what about a > function returning a collatable type? In particular, applying t

Re: [HACKERS] DO hint update?

2011-03-27 Thread Dimitri Fontaine
Tom Lane writes: > Perhaps "Use CREATE EXTENSION or CREATE LANGUAGE to load ..." ? The only better phrasing I can think of would be to replace the or with "then". Or… is it practical here to look at the available extensions and choose the HINT depending on whether the given language is there or

[HACKERS] Re: [COMMITTERS] pgsql: Fix plpgsql to release SPI plans when a function or DO block is

2011-03-27 Thread David Fetter
On Sun, Mar 27, 2011 at 04:51:13PM +, Tom Lane wrote: > Fix plpgsql to release SPI plans when a function or DO block is freed. Do the other PLs we ship need similar fixes? Cheers, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: david

Re: [HACKERS] Libpq PGRES_COPY_BOTH - version compatibility

2011-03-27 Thread Robert Haas
On Mar 27, 2011, at 4:09 PM, Magnus Hagander wrote: > That doesn't mean we shouldn't do this (haven't reconsidered the whole > thread) - but it doesn't solve the issue I originally raised. I'm somewhat inclined to just remove this from the list of open items. It doesn't seem clear what the actio

Re: [HACKERS] Libpq PGRES_COPY_BOTH - version compatibility

2011-03-27 Thread Simon Riggs
On Sun, Mar 27, 2011 at 9:09 PM, Magnus Hagander wrote: > On Sun, Mar 27, 2011 at 04:02, Simon Riggs wrote: >> On Sun, Mar 27, 2011 at 4:09 AM, Robert Haas wrote: >>> On Mon, Jan 3, 2011 at 6:55 AM, Magnus Hagander wrote: > ISTM that the correct fix is to increment to protocol version numbe

Re: [HACKERS] Performance Farm Release

2011-03-27 Thread Robert Haas
On Mar 27, 2011, at 3:20 PM, Greg Smith wrote: > I just dusted off this code and brought it back to current again. Basically > a lot of reformatting the new performance farm parts to minimize their diff. > Once that was done, all of the other buildfarm client updates since then > applied clea

Re: [HACKERS] SSI bug?

2011-03-27 Thread Kevin Grittner
YAMAMOTO Takashi wrote: > Kevin Grittner wrote: >> (1) Could you post the non-default configuration settings? > > none. it can happen with just initdb+createdb'ed database. > >> (2) How many connections are in use in your testing? > > 4. > >> (3) Can you give a rough categorization of how

Re: [HACKERS] Libpq PGRES_COPY_BOTH - version compatibility

2011-03-27 Thread Magnus Hagander
On Sun, Mar 27, 2011 at 04:02, Simon Riggs wrote: > On Sun, Mar 27, 2011 at 4:09 AM, Robert Haas wrote: >> On Mon, Jan 3, 2011 at 6:55 AM, Magnus Hagander wrote: ISTM that the correct fix is to increment to protocol version number to 3.1 and send PGRES_COPY_OUT if the client requests v

Re: [HACKERS] SSI bug?

2011-03-27 Thread Kevin Grittner
Tom Lane wrote: > There might perhaps be some value in adding a warning like this if > it were enabled per-table (and not enabled by default). It only fires where a maximum has been declared and is exceeded. Most HTABs don't declare a maximum -- they leave it at zero. These are ignored. Whe

Re: [HACKERS] SSI bug?

2011-03-27 Thread Kevin Grittner
Robert Haas wrote: > I don't see much advantage in changing these to asserts - in a > debug build, that will promote ERROR to PANIC; whereas in a > production build, they'll cause a random failure somewhere > downstream. The reason Assert is appropriate is that it is *impossible* to hit that c

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Jan Wieck
On 3/27/2011 1:24 PM, Simon Riggs wrote: So we should truncate in 16MB chunks also. On a second though, fiddling with the scan direction is probably too much of a change for back releases anyway. That 8.3/8.4 can get into a situation, where autovacuum causes a 12 minute freeze of a production

Re: [HACKERS] Performance Farm Release

2011-03-27 Thread Greg Smith
I just dusted off this code and brought it back to current again. Basically a lot of reformatting the new performance farm parts to minimize their diff. Once that was done, all of the other buildfarm client updates since then applied cleanly. The result is now sitting as a fork of Andrew's c

Re: [HACKERS] Open issues for collations

2011-03-27 Thread Tom Lane
Martijn van Oosterhout writes: > On Sat, Mar 26, 2011 at 12:36:43AM -0400, Tom Lane wrote: >> ** Selecting a field from a record-returning function's output. >> Currently, we'll use the field's declared collation; except that >> if the field has default collation, we'll replace that with the commo

[HACKERS] Re: [HACKERS] Needs Suggestion

2011-03-27 Thread Tomáš Pospíšil
You could use this in psql. Don't know how precise is it, but is enought for initial testing. postgres=# \timing Timing is on. postgres=# create index dx on diplomka using gist(data); CREATE INDEX Time: 236752.569 ms > Původní zpráva > Od: SUBHAM ROY > Předmět: Re: [H

Re: [HACKERS] race condition in sync rep

2011-03-27 Thread Simon Riggs
On Sun, Mar 27, 2011 at 6:07 PM, Kevin Grittner wrote: > Simon Riggs  wrote: > >> I'm surprised that a network roundtrip takes less time than the >> backend takes to mark clog and then queue for the SyncRepLock. > > I'm not surprised by that at all.  Some of our replication involves > Gb or faster

Re: [HACKERS] WIP: Allow SQL-language functions to reference parameters by parameter name

2011-03-27 Thread Pavel Stehule
2011/3/27 Martijn van Oosterhout : > On Sun, Mar 27, 2011 at 06:52:03PM +0200, Pavel Stehule wrote: >> Syntax for named parameters should be consistent with prepared >> statement. Is there any comments in standard? > > Well, there's section 4.24 which says: > > "In SQL-statements that are executed

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Simon Riggs
On Sun, Mar 27, 2011 at 2:13 PM, Robert Haas wrote: > On Mar 26, 2011, at 4:16 PM, Jan Wieck wrote: >> That was what I meant. Go in steps of 16-64MB backwards and scan from there >> to the current end in forward direction to find a nondeletable block. In >> between these steps, release and reac

Re: [HACKERS] Needs Suggestion

2011-03-27 Thread Gurjeet Singh
In these (Postgres) mailing lists, top-posting is not preferred. See my response below. On Sun, Mar 27, 2011 at 1:01 PM, SUBHAM ROY wrote: > > On Sun, Mar 27, 2011 at 10:20 PM, Gurjeet Singh > wrote: > >> On Sun, Mar 27, 2011 at 9:22 AM, SUBHAM ROY wrote: >> >>> Hi, >>> I am currently a studen

Re: [HACKERS] WIP: Allow SQL-language functions to reference parameters by parameter name

2011-03-27 Thread Martijn van Oosterhout
On Sun, Mar 27, 2011 at 06:52:03PM +0200, Pavel Stehule wrote: > Syntax for named parameters should be consistent with prepared > statement. Is there any comments in standard? Well, there's section 4.24 which says: "In SQL-statements that are executed dynamically, the parameters are called dynami

Re: [HACKERS] race condition in sync rep

2011-03-27 Thread Kevin Grittner
Simon Riggs wrote: > I'm surprised that a network roundtrip takes less time than the > backend takes to mark clog and then queue for the SyncRepLock. I'm not surprised by that at all. Some of our replication involves Gb or faster connections on the same LAN segment (sometimes on the same swit

Re: [HACKERS] Needs Suggestion

2011-03-27 Thread SUBHAM ROY
Actually, I want to run some set of queries in postgres on a HUGE data set. I have to compute the actual execution time for each of those queries. So how can I do that in Postgres ? Suppose in Oracle following thing can be done : * set timing on; select stuff from mytab; Elapsed: 00:00:02.82 *Li

Re: [HACKERS] WIP: Allow SQL-language functions to reference parameters by parameter name

2011-03-27 Thread Pavel Stehule
2011/3/27 Andrew Dunstan : > > > On 03/27/2011 09:42 AM, David Fetter wrote: >> >> On Fri, Mar 25, 2011 at 09:12:33PM -0400, Robert Haas wrote: >>> >>> As I've said before, I believe that the root cause of this problem is >>> that using the same syntax for variables and column names is a bad >>> id

Re: [HACKERS] Needs Suggestion

2011-03-27 Thread Gurjeet Singh
On Sun, Mar 27, 2011 at 9:22 AM, SUBHAM ROY wrote: > Hi, > I am currently a student of IIT Bombay. I am doing a project on "Benchmark > design". For that I need to measure the performance of various queries in > databases. > I want to know how can we measure the execution time of a query in Postg

Re: [HACKERS] Performance bug in DO blocks

2011-03-27 Thread Tom Lane
Robert Haas writes: > On Tue, Jan 18, 2011 at 1:46 PM, Tom Lane wrote: >> I just noticed that if you execute the same DO command over and over >> within a session, it gets slower and slower.  And if you keep it up >> you'll notice the backend's RAM consumption bloating too.  The cause >> appears

Re: [HACKERS] Needs Suggestion

2011-03-27 Thread 3dmashup
Subham, I would start with reviewing Prof Mike Stonebrakers and Dr Paula Hawthorns paper http://portal.acm.org/citation.cfm?doid=582095.582097 you can also look at Perftrack http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.101.7063&rep=rep1&type=pdf regards 3dmashUp On 3/27/2

Re: [HACKERS] WIP: Allow SQL-language functions to reference parameters by parameter name

2011-03-27 Thread Andrew Dunstan
On 03/27/2011 09:42 AM, David Fetter wrote: On Fri, Mar 25, 2011 at 09:12:33PM -0400, Robert Haas wrote: As I've said before, I believe that the root cause of this problem is that using the same syntax for variables and column names is a bad idea in the first place. If we used $foo or ?foo or

Re: [HACKERS] WIP: Allow SQL-language functions to reference parameters by parameter name

2011-03-27 Thread David Fetter
On Fri, Mar 25, 2011 at 09:12:33PM -0400, Robert Haas wrote: > On Fri, Mar 25, 2011 at 8:58 PM, Tom Lane wrote: > > Robert Haas writes: > >> On Mar 25, 2011, at 7:45 PM, Tom Lane wrote: > >>> Well, maybe, but it's not like it's subtle or hard to fix. > > > >> Depends how much of it you have. I'v

[HACKERS] Needs Suggestion

2011-03-27 Thread SUBHAM ROY
Hi, I am currently a student of IIT Bombay. I am doing a project on "Benchmark design". For that I need to measure the performance of various queries in databases. I want to know how can we measure the execution time of a query in Postgres (Explain analyze will not do). Also is there any tools avai

[HACKERS] Can I check if somebody is superuser in stored procedure?

2011-03-27 Thread Pavel Stehule
Hello Is there some simple possibility to check a rights from stored procedure? Regards Pavel Stehule -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Robert Haas
On Mar 26, 2011, at 4:16 PM, Jan Wieck wrote: > That was what I meant. Go in steps of 16-64MB backwards and scan from there > to the current end in forward direction to find a nondeletable block. In > between these steps, release and reacquire the exclusive lock so that client > transactions ca

Re: [HACKERS] Lock problem with autovacuum truncating heap

2011-03-27 Thread Simon Riggs
On Sat, Mar 26, 2011 at 8:05 PM, Jan Wieck wrote: > On 3/26/2011 12:12 PM, Simon Riggs wrote: >> >> On Sat, Mar 26, 2011 at 2:30 PM, Jan Wieck  wrote: >> >>>  My current idea for a fix is to modify lazy_truncate_heap(). It does >>> acquire >>>  and release the exclusive lock, so it should be possi

Re: [HACKERS] race condition in sync rep

2011-03-27 Thread Simon Riggs
On Sat, Mar 26, 2011 at 5:51 PM, Robert Haas wrote: > On Sat, Mar 26, 2011 at 12:41 PM, Simon Riggs wrote: >> Is it? Sync rep requires fsync on the standby. If you then explicitly >> turn off fsync on the standby then it has a performance impact, as >> documented. > > Actually, it doesn't, now th

Re: [HACKERS] DO hint update?

2011-03-27 Thread Robert Haas
On Mar 27, 2011, at 12:10 AM, Tom Lane wrote: > Hm ... the core languages would now prefer CREATE EXTENSION, but it's > not clear how fast non-core PLs will follow suit. > > Perhaps "Use CREATE EXTENSION or CREATE LANGUAGE to load ..." ? Dear me. If we don't know what's right, how will anyone el

Re: [HACKERS] WIP: Allow SQL-language functions to reference parameters by parameter name

2011-03-27 Thread Robert Haas
On Mar 27, 2011, at 6:11 AM, Dimitri Fontaine wrote: > Robert Haas writes: >> That syntax is sufficiently unwieldly that few people will want to use >> it in real life, but certainly the backward compatibility problem is >> much less than with what Tom proposed. > > Well, we would still support

[HACKERS] [DOCS] patch for createdb section in tutorial

2011-03-27 Thread Susanne Ebrecht
Hello, During translating the docs I found the following sentence in the tutorial section about createdb: "Database names must have an alphabetic first character and are limited to 63 characters" I wondered - really characters? shouldn't it be bytes? I just tested - creating a database by usin

Re: [HACKERS] WIP: Allow SQL-language functions to reference parameters by parameter name

2011-03-27 Thread Dimitri Fontaine
Robert Haas writes: > On Sat, Mar 26, 2011 at 5:19 PM, Dimitri Fontaine > wrote: >> I think the best choice is to only accept qualified parameter names in >> SQL functions (function_name.parameter_name).  If a referenced table >> share the function's name, ERROR out and HINT to alias the table n

Re: [HACKERS] Libpq PGRES_COPY_BOTH - version compatibility

2011-03-27 Thread Simon Riggs
On Sun, Mar 27, 2011 at 4:09 AM, Robert Haas wrote: > On Mon, Jan 3, 2011 at 6:55 AM, Magnus Hagander wrote: >>> ISTM that the correct fix is to increment to protocol version number to >>> 3.1 and send PGRES_COPY_OUT if the client requests version 3.0.  That's >>> what the version numbers are for