Re: [PATCHES] patch for temporary view from TODO list

2005-02-01 Thread Neil Conway
On Tue, 2005-02-01 at 01:28 -0500, Tom Lane wrote:
> The references to "CASCADED" (sic) in the patch are surely bogus.

Per SQL:2003 section 11.22, it is spelt "CASCADED". I'm not sure there's
a whole lot of value in documenting syntax we don't support, but if
we're going to do it we may as well get it right.

> "tempViewWalker" in view.c is bereft of either comments or a usefully
> descriptive name.  Yeah, you find out what it is supposed to do when you
> reach the routine below, but the whole thing is poorly presented.  Waste
> a static declaration forward reference so you can put the documented
> routine first, and rename the walker to something based on the calling
> routine's name.

I've added the forward declaration, but I couldn't think of a better
name for the walker routine. isViewOnTempTableWalker() seemed too
clumsy; any suggestions?

> Does the gram.y change really require breaking out OR REPLACE as a
> separate production, and if so why?  That strikes me as something
> that should not be necessary ... if it is then there is some deeper
> problem to investigate.

Without a separate production, you get 8 shift/reduce conflicts because
both opt_or_replace and OptTemp can be reduced on the empty string. The
easiest workaround I can see is the one implemented in the patch, but I
won't claim to be a bison expert. Suggestions for improvement are
welcome.

> The regression tests seem a tad excessive --- I'll grant this is a
> matter of taste, but if every tiny little feature we have were tested
> like that, the regression tests would take days to run.

I've removed a few tests that didn't seem helpful. As for the tests
taking "days to run", that would be fine with me -- if and when the
tests actually _do_ take a long time to run, we can put more effort into
defining a subset of them that can be run more quickly. In the mean
time, though, I think we have far too few tests, not too many.

> [ If I were applying this I'd just editorialize on these things without
> comment, but if you want to do it then you get to do the cleanup... ]

Thanks for your comments. A revised version of the patch is attached.

-Neil

Index: doc/src/sgml/ref/create_table.sgml
===
RCS file: /var/lib/cvs/pgsql/doc/src/sgml/ref/create_table.sgml,v
retrieving revision 1.91
diff -c -r1.91 create_table.sgml
*** doc/src/sgml/ref/create_table.sgml	22 Jan 2005 23:22:17 -	1.91
--- doc/src/sgml/ref/create_table.sgml	1 Feb 2005 23:32:45 -
***
*** 66,77 
  

 If a schema name is given (for example, CREATE TABLE
!myschema.mytable ...) then the table is created in the
!specified schema.  Otherwise it is created in the current schema.
!Temporary tables exist in a special schema, so a schema name may not be
!given when creating a temporary table.
!The table name must be distinct from the name of any other table,
!sequence, index, or view in the same schema.

  

--- 66,77 
  

 If a schema name is given (for example, CREATE TABLE
!myschema.mytable ...) then the table is created in the specified
!schema.  Otherwise it is created in the current schema.  Temporary
!tables exist in a special schema, so a schema name may not be given
!when creating a temporary table.  The name of the table must be
!distinct from the name of any other table, sequence, index, or view
!in the same schema.

  

Index: doc/src/sgml/ref/create_view.sgml
===
RCS file: /var/lib/cvs/pgsql/doc/src/sgml/ref/create_view.sgml,v
retrieving revision 1.29
diff -c -r1.29 create_view.sgml
*** doc/src/sgml/ref/create_view.sgml	4 Jan 2005 00:39:53 -	1.29
--- doc/src/sgml/ref/create_view.sgml	1 Feb 2005 23:32:45 -
***
*** 20,26 
  
   
  
! CREATE [ OR REPLACE ] VIEW name [ ( column_name [, ...] ) ] AS query
  
   
--- 20,26 
  
   
  
! CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] VIEW name [ ( column_name [, ...] ) ] AS query
  
   
***
*** 43,52 
  

 If a schema name is given (for example, CREATE VIEW
!myschema.myview ...) then the view is created in the
!specified schema.  Otherwise it is created in the current schema.
!The view name must be distinct from the name of any other view, table,
!sequence, or index in the same schema.

   
  
--- 43,54 
  

 If a schema name is given (for example, CREATE VIEW
!myschema.myview ...) then the view is created in the specified
!schema.  Otherwise it is created in the current schema.  Temporary
!views exist in a special schema, so a schema name may not be given
!when creating a temporary view. The name of the view must be
!distinct from the name of any other view, table, sequence, or index
!in the same schema.

   
  
***
*** 55,60 
--- 57,84 
  

 
+ TEMPORARY or TEMP
+   

Re: [PATCHES] Continue transactions after errors in psql

2005-02-01 Thread Greg Sabino Mullane

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
 
 
> Do you think it's better to create a server-side function or
> handle that in the client? How hard would it be to implement
> such a function? And what should it return? Only the name of
> the current top savepoint?
 
I think handled on the client. Otherwise, this will not work
for 8.0 and I'd like to see it able to do so. I tbink the
logic presented so far is good: I'll work on getting a new
patch out as soon as I can.
 
Still, a server-side function would eventually be nice, perhaps
have it return a setof savepoint names in order, allowing one
to easily grab the whole list or just the "latest/current" one.
 
- --
Greg Sabino Mullane [EMAIL PROTECTED]
PGP Key: 0x14964AC8 200502012248
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-BEGIN PGP SIGNATURE-
 
iD8DBQFCAE5IvJuQZxSWSsgRAqy7AJ4wo03ir/qRlRUxdC4sXId4OvlsswCgy50l
ldB3hFJaO88sBV1rfbADwwU=
=la3h
-END PGP SIGNATURE-



---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [PATCHES] patch for temporary view from TODO list

2005-02-01 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes:
> On Tue, 2005-02-01 at 01:28 -0500, Tom Lane wrote:
>> The references to "CASCADED" (sic) in the patch are surely bogus.

> Per SQL:2003 section 11.22, it is spelt "CASCADED".

Maybe I'm reading the wrong thing, but the only uses of CASCADED-with-
a-D that I see in the spec are in the context of WITH CHECK OPTION,
which this patch does not implement.  I am not sure why we are
documenting stuff we don't implement.

>> "tempViewWalker" in view.c is bereft of either comments or a usefully
>> descriptive name.

> I've added the forward declaration, but I couldn't think of a better
> name for the walker routine. isViewOnTempTableWalker() seemed too
> clumsy; any suggestions?

isViewOnTempTable_walker.  If that isn't euphonious to you, then change
the name of isViewOnTempTable.  Everywhere else that we have walker
subroutines, foo() invokes foo_walker().  You need a seriously good reason
to deviate from that convention.

>> Does the gram.y change really require breaking out OR REPLACE as a
>> separate production, and if so why?

> Without a separate production, you get 8 shift/reduce conflicts because
> both opt_or_replace and OptTemp can be reduced on the empty string.

[ scratches head... ]  Seems like it ought to work anyway, since there
are no lookahead keywords for which the parse is ambiguous.  I still
think there's something odd here.

If we do have to do it this way, a minor readability improvement would
be to write the CREATE case first and CREATE OR REPLACE second.

regards, tom lane

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PATCHES] patch for temporary view from TODO list

2005-02-01 Thread Neil Conway
On Wed, 2005-02-02 at 00:39 -0500, Tom Lane wrote:
> Maybe I'm reading the wrong thing, but the only uses of CASCADED-with-
> a-D that I see in the spec are in the context of WITH CHECK OPTION,
> which this patch does not implement.

Precisely; prior to the patch, WITH CHECK OPTION was documented in the
CREATE VIEW reference page, it was merely done incorrectly ("CASCADE",
not "CASCADED"). This patch corrects that documentation. Whether it is
worth documenting the syntax of unsupported features in the first place
is questionable, but if we're going to do it, we may as well do it
right.

-Neil



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


Re: [PATCHES] patch for temporary view from TODO list

2005-02-01 Thread Neil Conway
On Wed, 2005-02-02 at 00:39 -0500, Tom Lane wrote:
> isViewOnTempTable_walker.  If that isn't euphonious to you, then change
> the name of isViewOnTempTable.  Everywhere else that we have walker
> subroutines, foo() invokes foo_walker().  You need a seriously good reason
> to deviate from that convention.
[...]
> If we do have to do it this way, a minor readability improvement would
> be to write the CREATE case first and CREATE OR REPLACE second.

Patch applied to HEAD, including the above suggested changes.

Thanks for the patch, Koju.

-Neil



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq