Re: [HACKERS] Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1

2008-10-23 Thread Nikhil Sontakke
Hi, On Wed, Oct 22, 2008 at 8:14 PM, Jaime Casanova [EMAIL PROTECTED] wrote: just remembering that -patches is a dead list, so i'm sending this to -hackers where it will have more visibility... -- Forwarded message -- On 10/22/08, Nikhil Sontakke [EMAIL PROTECTED] wrote

Re: [HACKERS] Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1

2008-10-31 Thread Nikhil Sontakke
Hi, Thanks for taking a look. But if I am not mistaken Gavin and co. are working on a much exhaustive proposal. In light of that maybe this patch might not be needed in the first place? I will wait for discussion and a subsequent collective consensus here,

[HACKERS] No write stats in pg_statio system views

2008-11-06 Thread Nikhil Sontakke
Hi, What is the reason for not having heap_blks_write kind of stats in the pg_statio system views? Is it because bgwriter does the writing (we do have bg stats there) most of the times? Wouldn't the write stats help to get the complete IO picture for the relation? Regards, Nikhils --

Re: [HACKERS] Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1

2008-11-27 Thread Nikhil Sontakke
Hi, i review it on nov 6, and there were open questions by me and by Emmanuel none of those has been answered: http://archives.postgresql.org/pgsql-hackers/2008-11/msg00362.php Hmm, there's only one actual question in that email, which is a request for ideas about PL/pgsql vs. C. I

Re: [HACKERS] Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1

2008-11-27 Thread Nikhil Sontakke
Hi, The status has always being WIP, because what has not happened is that we have not had consensus on whether this is a logical first baby step ahead with partitioning. I haven't seen core members commenting on whether trying to aggregate the current set of manual operations together

Re: [HACKERS] Syntax for partitioning

2009-11-19 Thread Nikhil Sontakke
Hi, partinfo = (PartitionInfo *) malloc(ntups * sizeof(PartitionInfo)); 1) Please stop casting the results of palloc and malloc.  We are not writing C++ here. I thought it was/is a good C programming practice to typecast (void *) always to the returning structure type!! Regards, Nikhils

Re: [HACKERS] Partitioning option for COPY

2009-11-23 Thread Nikhil Sontakke
Hi, What would probably be helpful here is to take the mess of raw data above and turn it into a simpler partitioning roadmap. Thanks for summarising. Yeah, excellent summary Greg. As you rightly pointed out, partitioning needs a broad roadmap so that the community can contribute in unison.

[HACKERS] Why doesn't query_tree_walker examine the intoClause field?

2010-01-08 Thread Nikhil Sontakke
Hi, I am kinda puzzled as to why the query_tree_walker() function does not examine the intoClause field? I do see another function raw_expression_tree_walker() which does walk that entry. So what is the exact reason here? Or we just missed it for the earlier function? Regards, Nikhils --

Re: [HACKERS] Why doesn't query_tree_walker examine the intoClause field?

2010-01-08 Thread Nikhil Sontakke
PM, Nikhil Sontakke nikhil.sonta...@enterprisedb.com wrote: Hi, I am kinda puzzled as to why the query_tree_walker() function does not examine the intoClause field? I do see another function raw_expression_tree_walker() which does walk that entry. So what is the exact reason here? Or we just

Re: [HACKERS] plpgsql: numeric assignment to an integer variable errors out

2010-03-01 Thread Nikhil Sontakke
Hi, Now it is true that a lot of the uses for that were subsumed when we added coerce-via-IO to the native cast capabilities; but I'm still quite scared of what this would break, and I don't see any field demand for a change. Well, we have had one of our EDB connectors facing issues because

[HACKERS] CTAS not honoring NOT NULL, DEFAULT modifiers

2010-04-19 Thread Nikhil Sontakke
Guess no-one got to read this email. I sent it to pgsql-patches without realizing that it is a dead-list. Shouldn't we atleast bounce emails back to senders if they send an email to pgsql-patches? Regards, NIkhils -- Forwarded message -- From: Nikhil Sontakke nikhil.sonta

[HACKERS] row estimation off the mark when generate_series calls are involved

2010-04-19 Thread Nikhil Sontakke
Another email which went into the wilderness when I sent it to pgsql-patches. Regards, Nikhils -- Forwarded message -- From: Nikhil Sontakke nikhil.sonta...@enterprisedb.com Date: Fri, Apr 16, 2010 at 6:50 PM Subject: row estimation off the mark when generate_series calls

Re: [HACKERS] CTAS not honoring NOT NULL, DEFAULT modifiers

2010-04-19 Thread Nikhil Sontakke
Was wondering what are the standards for CTAS. Oracle seems to honor the NOT NULL modifier. This might be a bug if we do not honor modifiers in CTAS. Given that CREATE TABLE AS creates a table based on the result of a query, it seems pretty logical that constraints wouldn't be copied over -

Re: [HACKERS] row estimation off the mark when generate_series calls are involved

2010-04-20 Thread Nikhil Sontakke
Hi, I'm not very impressed with that patch, even discounting the sum-vs-product thinko.  Trawling the tlist for SRFs will add a significant number of cycles, to modify the rowcount in a way that is practically always wrong (since the estimates for SRF output rowcounts are so bad). It's

[HACKERS] possible memory leak with SRFs

2010-05-05 Thread Nikhil Sontakke
Hi, I saw this behavior with latest GIT head: create table xlarge(val numeric(19,0)); insert into xlarge values(generate_series(1,5)); The above generate series will return an int8 which will then be casted to numeric (via int8_to_numericvar) before being inserted into the table. I observed

Re: [HACKERS] possible memory leak with SRFs

2010-05-06 Thread Nikhil Sontakke
anyways. And AIUI, SRFs return tuples one-by-one or do we materialize the same into a tuplestore in some cases? Regards, Nikhils On Wed, May 5, 2010 at 7:23 PM, Nikhil Sontakke nikhil.sonta...@enterprisedb.com wrote: Hi, I saw this behavior with latest GIT head: create table xlarge(val numeric(19,0

Re: [HACKERS] possible memory leak with SRFs

2010-05-06 Thread Nikhil Sontakke
. And AIUI, SRFs return tuples one-by-one or do we materialize the same into a tuplestore in some cases? Regards, Nikhils On Wed, May 5, 2010 at 7:23 PM, Nikhil Sontakke nikhil.sonta...@enterprisedb.com wrote: Hi, I saw this behavior with latest GIT head: create table xlarge(val numeric

Re: [HACKERS] possible memory leak with SRFs

2010-05-07 Thread Nikhil Sontakke
Hi, Can someone please explain why we do not reset the expression context if an SRF is involved during execution? Consider        srf(foo(col)) where foo returns a pass-by-reference datatype.  Your proposed patch would cut the knees out from under argument values that the SRF could

Re: [HACKERS] possible memory leak with SRFs

2010-05-07 Thread Nikhil Sontakke
Yeah this is my basic confusion. But wouldn't the arguments be evaluated afresh on the subsequent call for this SRF? No, see ExecMakeFunctionResult().  If we did that we'd have serious problems with volatile functions, ie srf(random()). Ok thanks. So if someone uses a really long-running

Re: [HACKERS] UPDATE ... SET (a, b, c) = (expr)

2009-08-20 Thread Nikhil Sontakke
Hi Alvaro, But then there's the matter of how to represent it from the grammar inwards.  At first I thought of creating a new parse node type, say MultiResTarget that would replace ResTarget in UpdateStmt, and get it from there into the optimizer and executor. Hmm, I should be passing it

Re: [HACKERS] Ragged CSV import

2009-09-10 Thread Nikhil Sontakke
Hi, the two most useful are to read in only some of the defined columns, and to output to a separate disk file any rows which failed to match the expected format. The latter would not cause the copy to fail unless the count of such rows exceeded a user-specified threshold. +1 Allowing

Re: [HACKERS] Syntax for partitioning

2009-10-29 Thread Nikhil Sontakke
Hi, So, I'll take over the work if there are no ones to do it. I'm thinking to add syntax support first. Table partitioning was proposed many times, but it is still not applied into core. The reason is it is too difficult to make perfect partitioning feature at once. I think syntax support

Re: [HACKERS] Syntax for partitioning

2009-11-01 Thread Nikhil Sontakke
Hi, Is this the same as / similar to Oracle's syntax? Yes. IIRC Nikhil's patch was Oracle's syntax No. See: http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_7002.htm#i2125922 Any decent prevalent partitioning syntax should be ok IMHO. IIRC, MySQL paritioning

Re: [HACKERS] Patch committers

2009-11-11 Thread Nikhil Sontakke
Hi, True, but even I avoid patches I don't understand, and practicing by applying them could lead to a very undesirable outcome, e.g. instability. How about having a staging server to help around novice committers? Basically the selected new band of people can take a patch, review it and if

[HACKERS] plpgsql: numeric assignment to an integer variable errors out

2008-12-11 Thread Nikhil Sontakke
The following plpgsql function errors out with cvs head: CREATE function test_assign() returns void AS $$ declare x int; BEGIN x := 9E3/2; END $$ LANGUAGE 'plpgsql'; postgres=# select test_assign(); ERROR: invalid input syntax for integer: 4500. CONTEXT: PL/pgSQL function

Re: [HACKERS] Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1

2008-12-15 Thread Nikhil Sontakke
Hi, I will be working on a roadmap for the partitioning features. I think that there are different needs and that we will not be able to address them all in 8.5 or even 8.6. The goal will be to get things done step by step but possibly with a design that will not require major refactoring

Re: [HACKERS] Partitioning wiki page

2008-12-17 Thread Nikhil Sontakke
Hi, At the moment, all you've done is show examples of how Oracle does partitioning and restate my requirements document, significant chunks completely verbatim. If you do that I think it fair to ask for a specific credit on that. But even so, thank you for the compliment. It was not my

Re: [HACKERS] plpgsql: numeric assignment to an integer variable errors out

2008-12-29 Thread Nikhil Sontakke
Hi, nikhil.sonta...@enterprisedb.com wrote: The following plpgsql function errors out with cvs head: CREATE function test_assign() returns void AS $$ declare x int; BEGIN x := 9E3/2; END $$ LANGUAGE 'plpgsql'; postgres=# select test_assign(); ERROR: invalid input syntax for integer:

Re: [HACKERS] plpgsql: numeric assignment to an integer variable errors out

2008-12-29 Thread Nikhil Sontakke
Hi, The following plpgsql function errors out with cvs head: CREATE function test_assign() returns void AS $$ declare x int; BEGIN x := 9E3/2; END $$ LANGUAGE 'plpgsql'; postgres=# select test_assign(); ERROR: invalid input syntax for integer: 4500.

[HACKERS] float8 strtod weirdness

2009-01-07 Thread Nikhil Sontakke
Hi, Consider the following with latest CVS sources: postgres=# create table temp(val float4); CREATE TABLE postgres=# insert into temp values (415.1); INSERT 0 1 postgres=# select * from temp where val = 415.1; val - (0 rows) !? The reason seems to be that 415.1 ends up being treated as a

[HACKERS] composite types DROP..CASCADE behaviour - bug or intentional?

2009-02-13 Thread Nikhil Sontakke
Hi, Consider the following on latest sources: postgres=# create type c3 as (y int, z c1); postgres=# create type comptype1 as (elem1 int); postgres=# create type comptype2 as (elem1 int, elem2 comptype1); postgres=# \d comptype2 Composite type public.comptype2 Column | Type

Re: [HACKERS] composite types DROP..CASCADE behaviour - bug or intentional?

2009-02-13 Thread Nikhil Sontakke
Consider the following on latest sources: postgres=# create type c3 as (y int, z c1); Oops, please disregard the above copy-paste unwanted sql. postgres=# create type comptype1 as (elem1 int); postgres=# create type comptype2 as (elem1 int, elem2 comptype1); postgres=# \d comptype2

[HACKERS] gcc: why optimize for size flag is not the default

2009-03-11 Thread Nikhil Sontakke
Hi, I was wondering why -Os is not used in place of -O2 while compiling the Postgres sources with gcc. I prepared 2 install directories by respectively using -Os and -O2 flags and in the former case it seems to reduce the install footprint by about 1MB or so. Agreed this is not significant for

[HACKERS] cross-compiling plpython

2009-03-16 Thread Nikhil Sontakke
So, I realized that there does not seem to be an easy way for cross compiling plpython. The configure checks for the locally installed python include locations and eventually the plpython makefile ends up picking all the local includes too. Does anyone have any experiences on cross-compiling

Re: [HACKERS] cross-compiling plpython

2009-03-17 Thread Nikhil Sontakke
So, I realized that there does not seem to be an easy way for cross compiling plpython. The configure checks for the locally installed python include locations and eventually the plpython makefile ends up picking all the local includes too. Does anyone have any experiences on cross-compiling

Re: [HACKERS] Partitioning feature ...

2009-03-23 Thread Nikhil Sontakke
Hi Kedar, The syntax used conforms to most of the suggestions mentioned in http://archives.postgresql.org/pgsql-hackers/2008-01/msg00413.php, barring the following: -- Specification of partition names is optional. System will be able to generate partition names in such cases. -- Sub

Re: [HACKERS] Partitioning feature ...

2009-03-31 Thread Nikhil Sontakke
Hi, As triggers are executed in order of their names, we've prefixed the trigger names with zz. This should work fine as long as no-one uses trigger-name which starts with zz. this seems a lot fragile... why system generated triggers has to be executed following the same rules

Re: [HACKERS] Partitioning feature ...

2009-03-31 Thread Nikhil Sontakke
Hi, We already have system triggers -- the FK triggers. I don't think we've had all that much trouble with them. In the case of the FK triggers, it's intentional (and maybe even documented) that users should be able to place their own triggers before or after the FK triggers. If it's

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Nikhil Sontakke
Hi, Considering the following sequence: create table t(a int primary key); alter table t drop constraint t_pkey; insert into t values(null); ERROR: null value in column a violates not-null constraint My question is, why null is not allowed to be inserted after primary

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-02 Thread Nikhil Sontakke
Hi, Making a column into the primary key forces the column to NOT NULL. You'll need to DROP NOT NULL separately. It's probably possible to beat on the code hard enough to fix this, Yeah it will be a matter of finding the affected column entries and invoking the removal of the not

Re: [HACKERS] Bug of ALTER TABLE DROP CONSTRAINT

2009-04-03 Thread Nikhil Sontakke
Hi, We've discussed before the idea that NOT NULL constraints should be explicitly represented in pg_constraint, just like general CHECK constraints (this would allow them to be named, have sane inheritance behavior, etc). If we had that, then pg_attribute.attnotnull could indicate the OR

Re: [HACKERS] Automating Partitions in PostgreSQL - Query on syntax

2009-04-21 Thread Nikhil Sontakke
(...) PARTITION BY RANGE (emp_id) ( emp_500 (START 1 END 500), emp_1500 (START 500 END 1500), emp_4000 (START 1520 END 4000) ); What if I need more columns to set the partitions? You can do so by using command like this, CREATE TABLE emp ( emp_id

Re: [HACKERS] Throw some low-level C scutwork at me

2009-05-02 Thread Nikhil Sontakke
Hi, OK, so, when I initially started catching up on this thread, I was kind of feeling annoyed at Tom, and I still wish he'd say something along the lines of I did not mean to give offense and I'm sorry if my words came across in a way that I did not intend rather than just explaining

Re: [HACKERS] ruby connect

2009-05-31 Thread Nikhil Sontakke
Hi, I’m trying to connect ruby to postgres on ubuntu and the only link I found that has the library is down. Does anyone have the postgres library for ruby? Or direct me to it? You would be better off searching for the drivers on rubyforge.org. Please do not send non-Postgres-development

Re: [HACKERS] Patch for automating partitions in PostgreSQL 8.4 Beta 2

2009-06-09 Thread Nikhil Sontakke
Hi, The patch automates table partitioning to support Range and Hash partitions. Please refer to attached readme file for further details. The syntax used conforms to most of the suggestions mentioned in http://archives.postgresql.org/pgsql-hackers/2008-01/msg00413.php, barring the

Re: [HACKERS] 8.5 development schedule

2009-06-30 Thread Nikhil Sontakke
Hi, However, if anything, I think if anything we should go the other way and start the first CommitFest July 15th. I'm curious what the counter-arguments to this are.  Is it review-fatigue from getting the release out, or is there an economy of scale to building up a 100 patches before

Re: [HACKERS] [PATCH] DefaultACLs

2009-07-16 Thread Nikhil Sontakke
Hi Petr, this is first public version of our DefaultACLs patch as described on http://wiki.postgresql.org/wiki/DefaultACL . I have been assigned by Robert to do an initial review of your GRANT ON ALL patch mentioned here (http://archives.postgresql.org/pgsql-hackers/2009-07/msg00207.php) Does

Re: [HACKERS] [PATCH] DefaultACLs

2009-07-17 Thread Nikhil Sontakke
Hi, No, DefaultACLs applies to objects created in the future while GRANT ON ALL affects existing objects. I see. DefaultACLs is more important functionality so it should probably take precedence in review process. There is however one thing that needs some attention. Both patches add

Re: [HACKERS] GRANT ON ALL IN schema

2009-07-17 Thread Nikhil Sontakke
Hi, Attached is v2 with slightly improved code, nothing has changed feature-wise. Here are some comments on this patch from my side: grant.sgml * Maybe we should use replaceable class=parameterschemaname/replaceable in the sgml references instead of just replaceableschemaname/replaceable

Re: [HACKERS] [PATCH] DefaultACLs

2009-07-17 Thread Nikhil Sontakke
Hi, I briefly looked at the DefaultACLs patch. Can you not re-use the GrantStmt structure for the defaults purpose too? You might have to introduce an is_default boolean similar to the is_schema boolean that  you have added in the GRANT ON ALL patch. If you think you can re-use the GrantStmt

Re: [HACKERS] GRANT ON ALL IN schema

2009-07-20 Thread Nikhil Sontakke
Hi, Nikhil, This is still flagged as Needs Review.  Are you still reviewing the latest version, or should this be set to ready for committer, or what? The review is complete from my side. There is this question about consistency between this patch and the Defaultacls patch. But am ok with

Re: [HACKERS] [PATCH] DefaultACLs

2009-07-23 Thread Nikhil Sontakke
Hi, Anyway, while this patch might not necessary get commited in this commit fest, I'd still like to have opinion from one of the commiters on the VIEW problem which also affects grant on all patch ( see http://archives.postgresql.org/pgsql-hackers/2009-07/msg00957.php ) and I fear returned

Re: [HACKERS] [PATCH] DefaultACLs

2009-07-24 Thread Nikhil Sontakke
Hi, I'd still like to have opinion from one of the commiters on the VIEW problem which also affects grant on all patch ( see http://archives.postgresql.org/pgsql-hackers/2009-07/msg00957.php ) and I fear returned with feedback might prevent that until next commit fest. I see potential for

Re: [HACKERS] Review: Non-inheritable check constraints

2011-12-22 Thread Nikhil Sontakke
Hi, There is at least one other problem. Consider: rhaas=# create table a (ff1 int, constraint chk check (ff1 0)); CREATE TABLE rhaas=# create table b (ff1 int, constraint chk check (ff1 0)); CREATE TABLE rhaas=# alter table b inherit a; ALTER TABLE This needs to fail if chk is an

Re: [HACKERS] Review: Non-inheritable check constraints

2011-12-22 Thread Nikhil Sontakke
refused to inherit. Regards, Nikhils On Fri, Dec 23, 2011 at 8:55 AM, Nikhil Sontakke nikkh...@gmail.com wrote: Hi, There is at least one other problem. Consider: rhaas=# create table a (ff1 int, constraint chk check (ff1 0)); CREATE TABLE rhaas=# create table b (ff1 int, constraint chk

Re: [HACKERS] Review: Non-inheritable check constraints

2011-12-22 Thread Nikhil Sontakke
I don't think this is a given ... In fact, IMO if we're only two or three fixes away from having it all nice and consistent, I think reverting is not necessary. FWIW, here's a quick fix for the issue that Robert pointed out. Again it's a variation of the first issue that he reported. We have

Re: [HACKERS] Review: Non-inheritable check constraints

2011-12-26 Thread Nikhil Sontakke
I don't think this is a given ... In fact, IMO if we're only two or three fixes away from having it all nice and consistent, I think reverting is not necessary. Sure. It's the if part of that sentence that I'm not too sure about. Any specific area of the code that you think is/has

Re: [HACKERS] Review: Non-inheritable check constraints

2012-01-16 Thread Nikhil Sontakke
I have also tried to change the error message as per Alvaro's suggestions. I will really try to see if we have other issues. Really cannot have Robert reporting all the bugs and getting annoyed, but there are lotsa variations possible with inheritance.. So did you find anything?

Re: [HACKERS] Review: Non-inheritable check constraints

2012-01-16 Thread Nikhil Sontakke
I will really try to see if we have other issues. Really cannot have Robert reporting all the bugs and getting annoyed, but there are lotsa variations possible with inheritance.. BTW thank you for doing the work on this. Probably the reason no one bothers too much with inheritance is

Re: [HACKERS] how to create a non-inherited CHECK constraint in CREATE TABLE

2012-01-17 Thread Nikhil Sontakke
It appears that the only way to create a non-inherited CHECK constraint is using ALTER TABLE. Is there no support in CREATE TABLE planned? That looks a bit odd. There are no plans to do that AFAIR, though maybe you could convince Nikhil to write the patch to do so. That certainly

Re: [HACKERS] Review of patch renaming constraints

2012-01-19 Thread Nikhil Sontakke
Make check passed. Patch has tests for rename constraint. Most normal uses of alter table ... rename constraint ... worked normally. However, the patch does not deal correctly with constraints which are not inherited, such as primary key constraints: That appears to be because creating

Re: [HACKERS] Review of patch renaming constraints

2012-01-19 Thread Nikhil Sontakke
And primary keys are anyways not inherited. So why is the conisonly field interfering in rename? Seems quite orthogonal to me. In the past, each kind of constraint was either always inherited or always not, implicitly. Now, for check constraints we can choose what we want, and in the

Re: [HACKERS] Bug in ALTER COLUMN SET DATA TYPE ?

2012-11-02 Thread Nikhil Sontakke
postgres=# CREATE TABLE test (a float check (a 10.2)); CREATE TABLE postgres=# CREATE TABLE test_child() INHERITS(test); CREATE TABLE postgres=# ALTER TABLE test ALTER COLUMN a SET DATA TYPE numeric; ERROR: constraint must be added to child tables too Interestingly, this works in

Re: [HACKERS] Bug in ALTER COLUMN SET DATA TYPE ?

2012-11-02 Thread Nikhil Sontakke
So coming back to the issue, do you think it's a good idea to teach ATAddCheckConstraint() that the call is coming from a late phase of ALTER TABLE ? +1 You mentioned AT_PASS_OLD_INDEX in your original mail, but I guess that you meant that we should check for AT_PASS_OLD_CONSTR and then not

Re: [HACKERS] how to create a non-inherited CHECK constraint in CREATE TABLE

2012-04-11 Thread Nikhil Sontakke
Hi, So, I have a patch for this. This patch introduces support for CHECK ONLY syntax while doing a CREATE TABLE as well as during the usual ALTER TABLE command. Example: create table atacc7 (test int, test2 int CHECK ONLY (test0), CHECK (test210)); create table atacc8 () inherits (atacc7);

Re: [HACKERS] how to create a non-inherited CHECK constraint in CREATE TABLE

2012-04-11 Thread Nikhil Sontakke
Hi, Cumulative reaction to all the responses first: Whoa! :) I was under the impression that a majority of us felt that the current mechanism was inadequate. Also if you go through the nabble thread, the fact that CREATE TABLE did not support such constraints was considered to be an annoyance.

Re: [HACKERS] how to create a non-inherited CHECK constraint in CREATE TABLE

2012-04-16 Thread Nikhil Sontakke
Displace yes. It would error out if someone says ALTER TABLE ONLY... CHECK (); suggesting to use the ONLY with the CHECK. I'd say the behavior for that case can revert to the PostgreSQL 9.1 behavior. If the table has children, raise an error. Otherwise, add an inheritable CHECK

Re: [HACKERS] B-tree page deletion boundary cases

2012-04-21 Thread Nikhil Sontakke
Hi Noah, Was wondering if there's a similar bug which gets triggered while using VACUUM FULL. See for instance this thread: http://postgresql.1045698.n5.nabble.com/index-corruption-in-PG-8-3-13-td4257589.html This issue has been reported on-off from time to time and in most cases VACUUM or

Re: [HACKERS] B-tree page deletion boundary cases

2012-04-24 Thread Nikhil Sontakke
Was wondering if there's a similar bug which gets triggered while using VACUUM FULL. See for instance this thread: http://postgresql.1045698.n5.nabble.com/index-corruption-in-PG-8-3-13-td4257589.html This issue has been reported on-off from time to time and in most cases VACUUM or

[HACKERS] xml_is_document and selective pg_re_throw

2012-06-12 Thread Nikhil Sontakke
Hi, Consider: SELECT xml 'foobar/foobarfoo/bar' IS DOCUMENT; And I was looking at xml_is_document() source code. It calls xml_parse which throws an error with code set to ERRCODE_INVALID_XML_DOCUMENT. The catch block of xml_parse then rethrows. Now xml_is_document does a selective rethrow only

Re: [HACKERS] xml_is_document and selective pg_re_throw

2012-06-13 Thread Nikhil Sontakke
No, I don't see any particular risk there. The places that might throw ERRCODE_INVALID_XML_DOCUMENT are sufficiently few (as in, exactly one, in this usage) that we can have reasonable confidence we know what the system state is when we catch that error. Hmmm, I was writing some code in

Re: [HACKERS] Check constraints on partition parents only?

2011-07-26 Thread Nikhil Sontakke
8.4 had this change: * Force child tables to inherit CHECK constraints from parents (Alex Hunsaker, Nikhil Sontakke, Tom) You're not the only one who occasionally bangs his head against it. Sorry for the occasional head bumps :) Yeah. I think it's

Re: [HACKERS] Check constraints on partition parents only?

2011-07-27 Thread Nikhil Sontakke
Hi, Yeah, but I think we need to take that chance. At the very least, we need to support the equivalent of a non-inherited CHECK (false) on parent tables. Indeed. I usually enforce that with a trigger that raises an exception, but of course that doesn't help at all with constraint

Re: [HACKERS] Check constraints on partition parents only?

2011-07-28 Thread Nikhil Sontakke
Now that we have coninhcnt, conislocal etc... we can probably support ONLY. But I agree with Robert it's probably a bit more than an afternoon to crank out :-) Heh, agreed :), I was just looking for some quick and early feedback. So what we need is basically a way to indicate that a

Re: [HACKERS] Check constraints on partition parents only?

2011-07-28 Thread Nikhil Sontakke
This approach certainly can't work, because a table can be both an inheritance parent and an inheritance child. It could have an ONLY constraint, and also inherit a copy of the same constraint for one or more parents. IOW, the fact that conislocal = true does not mean that coninhcount is

Re: [HACKERS] Check constraints on partition parents only?

2011-07-29 Thread Nikhil Sontakke
Hi, Any preferences for the name? connoinh conisonly constatic or confixed I'd probably pick conisonly from those choices. The use of \d inside psql will show ONLY constraints without any embellishments similar to normal constraints. E.g. ALTER TABLE ONLY a ADD CONSTRAINT achk CHECK

Re: [HACKERS] Check constraints on partition parents only?

2011-07-29 Thread Nikhil Sontakke
psql=# \d a Table public.a Column | Type | Modifiers +-+--- b | integer | Check constraints: achk CHECK (false) bchk CHECK (b 0) Is this acceptable? Or we need to put in work into psql to show ONLY somewhere in the description? If yes, ONLY

Re: [HACKERS] Check constraints on partition parents only?

2011-07-29 Thread Nikhil Sontakke
Yeah, I have already hacked it a bit. This constraint now needs to be spit out later as an ALTER command with ONLY attached to it appropriately. Earlier all CHECK constraints were generally emitted as part of the table definition itself. Hrm. That doesn't seem so good. Maybe we've got

Re: [HACKERS] Check constraints on partition parents only?

2011-07-29 Thread Nikhil Sontakke
Yeah, I have already hacked it a bit. This constraint now needs to be spit out later as an ALTER command with ONLY attached to it appropriately. Earlier all CHECK constraints were generally emitted as part of the table definition itself. IIRC, there's already support for splitting out a

Re: [HACKERS] Check constraints on partition parents only?

2011-07-29 Thread Nikhil Sontakke
We could imagine doing something like CHECK ONLY (foo), but that seems quite non-orthogonal with (a) everything else in CREATE TABLE, and (b) ALTER TABLE ONLY. Yeah, I thought about CHECK ONLY support as part of table definition, but as you say - it appears to be too non-standard right now

Re: [HACKERS] Check constraints on partition parents only?

2011-07-29 Thread Nikhil Sontakke
Hi all, PFA, patch which implements non-inheritable ONLY constraints. This has been achieved by introducing a new column conisonly in pg_constraint catalog. Specification of 'ONLY' in the ALTER TABLE ADD CONSTRAINT CHECK command is used to set this new column to true. Constraints which have this

Re: [HACKERS] Check constraints on partition parents only?

2011-07-29 Thread Nikhil Sontakke
Comments and further feedback, if any, appreciated. Did you look at how this conflicts with my patch to add not null rows to pg_constraint? https://commitfest.postgresql.org/action/patch_view?id=601 I was certainly not aware of this patch in the commitfest. Your patch has a larger

Re: [HACKERS] cataloguing NOT NULL constraints

2011-08-04 Thread Nikhil Sontakke
So after writing the code to handle named NOT NULL constraints for tables, I'm thinking that dumpConstraints needs to be fixed thusly: @@ -12888,6 +12968,27 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)                         NULL, NULL);        }    } +   else if

[HACKERS] Favorable i--)

2010-11-27 Thread Nikhil Sontakke
Hi, a very good business company, I suggest you go to see: mobiles3gs.com, and now all of products enjoy great discount, saving time and money. h--) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

[HACKERS] Issue with listing same tablenames from different schemas in the search_path

2011-10-02 Thread Nikhil Sontakke
Hi, Consider the following sequence of commands in a psql session: postgres=#create table public.sample(x int); postgres=#create schema new; postgres=#create table new.sample(x int); postgres=#set search_path=public,new; postgres=#\dt Schema | Name | Type | Owner

Re: [HACKERS] Issue with listing same tablenames from different schemas in the search_path

2011-10-02 Thread Nikhil Sontakke
postgres=#create table public.sample(x int); postgres=#create schema new; postgres=#create table new.sample(x int); postgres=#set search_path=public,new; postgres=#\dt Schema | Name | Type | Owner --**- public | sample | table | postgres

Re: [HACKERS] Review: Non-inheritable check constraints

2011-10-06 Thread Nikhil Sontakke
Hi Alex, I didn't care for the changes to gram.y so I reworked it a bit so we now pass is_only to AddRelationNewConstraint() (like we do with is_local). Seemed simpler but maybe I missed something. Comments? Hmmm, your patch checks for a constraint being only via: !recurse

Re: [HACKERS] Review: Non-inheritable check constraints

2011-10-07 Thread Nikhil Sontakke
Hi Alex, Hmmm, your patch checks for a constraint being only via: !recurse !recursing I hope that is good enough to conclusively conclude that the constraint is 'only'. This check was not too readable in the existing code for me anyways ;). If we check at the grammar

Re: [HACKERS] Review: Non-inheritable check constraints

2011-10-07 Thread Nikhil Sontakke
for the thorough review and subsequent changes! Regards, Nikhils On Fri, Oct 7, 2011 at 12:18 PM, Alex Hunsaker bada...@gmail.com wrote: On Fri, Oct 7, 2011 at 00:28, Nikhil Sontakke nikkh...@gmail.com wrote: Hi Alex, So with it all spelled out now I see the constraint must be added to child

[HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-09 Thread Nikhil Sontakke
Hi, Consider the following sequence of events: s1 # CREATE SCHEMA test_schema; s1 # CREATE TABLE test_schema.c1(x int); Now open another session s2 and via gdb issue a breakpoint on heap_create_with_catalog() which is called by DefineRelation(). s2 # CREATE TABLE test_schema.c2(y int); The

Re: [HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-09 Thread Nikhil Sontakke
We definitely need some interlocking to handle this. For lack of better APIs, we could do a LockDatabaseObject() call in AccessShareLock mode on the namespace and release the same on completion of the creation of the object. Thoughts? In general, we've been reluctant to add locking

Re: [HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-09 Thread Nikhil Sontakke
Yeah thanks, that does the object locking. For pre-9.1 versions, we will need a similar solution. I encountered the issue on 8.3.x.. I don't think we should back-patch a fix of this type. There is a lot of cruftiness of this type scattered throughout the code base, and if we start

Re: [HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-10 Thread Nikhil Sontakke
Hi, Ok, understood. PFA, a patch against git head. We take the AccessShareLock lock on the schema in DefineRelation now. Note that we do not want to interlock with other concurrent creations in the schema. We only want to interlock with deletion activity. So even performance wise this should

Re: [HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-10 Thread Nikhil Sontakke
Um ... why would we do this only for tables, and not for creations of other sorts of objects that belong to schemas? Right, we need to do it for other objects like functions etc. too. Also, if we are going to believe that this is a serious problem, what of ALTER ... SET SCHEMA? I admit,

Re: [HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-10 Thread Nikhil Sontakke
Continuing in gdb, also completes the creation of c2 table without any errors. We are now left with a dangling entry in pg_class along with all the corresponding data files in our data directory. The problem becomes worse if c2 was created using a TABLESPACE. Now dropping of that

[HACKERS] pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-10 Thread Nikhil Sontakke
Hi, But if it's deemed to be a problem, I want to see a solution that's actually watertight.) After Daniel's hunch about pg_dump barfing due to such leftover entries proving out to be true, we have one credible explanation (there might be other reasons too) for this long standing issue. I

Re: [HACKERS] Re: pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-11 Thread Nikhil Sontakke
Wasn't 7.3 the release that introduced schemas in the first place? I think there's a very good chance that the older reports with similar symptoms are completely unrelated, anyhow. Tom Lane is reluctant and that should tell me something :) So unless the list feels that this should be fixed

Re: [HACKERS] So where are we on the open commitfest?

2011-11-14 Thread Nikhil Sontakke
* Non-inheritable check constraints So, this patch got shifted to the next commitfest... Regards, Nikhils

Re: [HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-14 Thread Nikhil Sontakke
If all you need to do is lock a schema, you can just call LockDatabaseObject(NamespaceRelationId, namespace_oid, 0, AccessShareLock); there's no need to fake up an objectaddress just to take a lock. But I think that's not really all you need to do, because somebody could drop the namespace

Re: [HACKERS] Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

2011-11-14 Thread Nikhil Sontakke
So it's probably going to take a while to get this completely nailed down, but we can keep chipping away at it. Agreed. So are you planning to commit this change? Or we want some more objects to be fixed? Last I looked at this, we will need locking to be done while creating tables, views,

  1   2   >