Proposed patch for contrib/cube

Started by Joshua Reichover 19 years ago10 messageshackers
Jump to latest
#1Joshua Reich
josh@root.net

Ok. So, the cube code looks very unmaintained (not to offend anyone),
but it is all in V0 and I believe make installcheck fails out of the box
due to new error message formats. I'm in the process of twisting the arm
of another guy here to help me clean up the code - if that is ok with
the powers that be?

While we are working on that, here is a patch for contrib/cube that
allows you to create a cube from 2 float[]'s. This avoids an ugly step
of casting arrays to varchars, and then replacing the {'s with ('s...

This is my first patch submission, so please let me know what heinous
errors I have made, and if I'm not too battered after the process I'll
begin the cleanup of the contrib/cube tree.

Thanks all!

Josh Reich

Josh Berkus wrote:

Josh,

What is the general process for submitting patches? Is there a URL
someone can point me towards to learn more?

Send them in an e-mail to pgsql-patches.

--
Joshua Reich
Finance and Corporate Development
ROOT Exchange, A Division of ROOT Markets
601 W. 26th St. / Suite 1500
New York, NY 10001
W - (212) 645 6320 x 7101
M / T - (646) 427 7959
E - josh@rootexchange.com

Attachments:

cube.c.difftext/plain; name=cube.c.diff; x-mac-creator=0; x-mac-type=0Download+66-0
cube.sql.in.difftext/plain; name=cube.sql.in.diff; x-mac-creator=0; x-mac-type=0Download+6-0
#2Neil Conway
neilc@samurai.com
In reply to: Joshua Reich (#1)
Re: Proposed patch for contrib/cube

On Mon, 2006-07-17 at 17:55 -0400, Joshua Reich wrote:

Ok. So, the cube code looks very unmaintained (not to offend anyone),
but it is all in V0 and I believe make installcheck fails out of the box
due to new error message formats.

It passes for me with CVS HEAD. The cube regression test is also run as
part of the buildfarm process, so it sounds like an error on your end.

I'm in the process of twisting the arm of another guy here to help me
clean up the code - if that is ok with the powers that be?

Cleanup would certainly be welcome.

This is my first patch submission, so please let me know what heinous
errors I have made

You should submit patches in context diff format (diff -c). You should
also send a single patch for all the (related) changes you want to make,
and you seem to have omitted the diff headers. You should generate
patches like:

$ cvs diff # from the root of the source tree

or

$ diff -rc ../orig_tree . # from the root of the modified tree

Depending on whether you're working against CVS or if you've made a copy
of the source tree to make your changes in.

if (ARRNELEMS(ll) != dim)
{
ereport(ERROR,
(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
errmsg("UR and LL arrays must be of same

length")));

PG_RETURN_NULL();
}

You don't need to return anything after ereport(ERROR) -- it won't
return control to the caller.

-Neil

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joshua Reich (#1)
Re: Proposed patch for contrib/cube

Joshua Reich <josh@root.net> writes:

if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
{
ereport(ERROR,
(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
errmsg("Cannot work with NULL arrays")));
}

This is useless code if the function is declared STRICT, as C functions
most often are. What you *do* need to be checking is ARR_HASNULL(),
since there isn't anything very useful you can do with null elements
within the arrays.

regards, tom lane

#4Joshua Reich
josh@root.net
In reply to: Neil Conway (#2)
Re: [PATCHES] Proposed patch for contrib/cube

I have completed upgrading the cube codebase to use the V1 call
protocol. However, before I submit a patch I would really like to work
out why I have never been able to get cube to pass installcheck.

This is what I get when I run installcheck on a clean version of 8.1.4
(I get similar results on CVS HEAD). The regression.diff is attached.

josh:~/installs/postgresql-8.1.4/contrib/cube josh$ make installcheck
make -C ../../src/test/regress pg_regress
make[1]: `pg_regress' is up to date.
/bin/sh ../../src/test/regress/pg_regress --dbname=contrib_regression cube
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
============== dropping regression test user accounts ==============
============== running regression test queries ==============
test cube ... FAILED

======================
1 of 1 tests failed.
======================

I have tried this both on OS X and Linux and get similar results.

Josh Reich

Neil Conway wrote:

Show quoted text

On Mon, 2006-07-17 at 17:55 -0400, Joshua Reich wrote:

Ok. So, the cube code looks very unmaintained (not to offend anyone),
but it is all in V0 and I believe make installcheck fails out of the box
due to new error message formats.

It passes for me with CVS HEAD. The cube regression test is also run as
part of the buildfarm process, so it sounds like an error on your end.

Attachments:

regression.diffstext/plain; name=regression.diffs; x-mac-creator=0; x-mac-type=0Download+48-48
#5Joshua Reich
josh@root.net
In reply to: Neil Conway (#2)
Re: Proposed patch for contrib/cube

Please find my cleanup of cube attached.

I have also included the cube_a_f8_f8() function to allow construction
of a cube from 2 float8[]'s.

Thanks,

Josh Reich

Neil Conway wrote:

Show quoted text

On Mon, 2006-07-17 at 17:55 -0400, Joshua Reich wrote:

Ok. So, the cube code looks very unmaintained (not to offend anyone),
but it is all in V0 and I believe make installcheck fails out of the box
due to new error message formats.

It passes for me with CVS HEAD. The cube regression test is also run as
part of the buildfarm process, so it sounds like an error on your end.

I'm in the process of twisting the arm of another guy here to help me
clean up the code - if that is ok with the powers that be?

Cleanup would certainly be welcome.

This is my first patch submission, so please let me know what heinous
errors I have made

You should submit patches in context diff format (diff -c). You should
also send a single patch for all the (related) changes you want to make,
and you seem to have omitted the diff headers. You should generate
patches like:

$ cvs diff # from the root of the source tree

or

$ diff -rc ../orig_tree . # from the root of the modified tree

Depending on whether you're working against CVS or if you've made a copy
of the source tree to make your changes in.

if (ARRNELEMS(ll) != dim)
{
ereport(ERROR,
(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
errmsg("UR and LL arrays must be of same

length")));

PG_RETURN_NULL();
}

You don't need to return anything after ereport(ERROR) -- it won't
return control to the caller.

-Neil

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Attachments:

cube_v0_to_v1.difftext/plain; name=cube_v0_to_v1.diffDownload+644-540
#6Andrew Dunstan
andrew@dunslane.net
In reply to: Joshua Reich (#4)
Re: [PATCHES] Proposed patch for contrib/cube

What version of bison do you have?

cheers

andrew

Joshua Reich wrote:

Show quoted text

I have completed upgrading the cube codebase to use the V1 call
protocol. However, before I submit a patch I would really like to work
out why I have never been able to get cube to pass installcheck.

This is what I get when I run installcheck on a clean version of 8.1.4
(I get similar results on CVS HEAD). The regression.diff is attached.

josh:~/installs/postgresql-8.1.4/contrib/cube josh$ make installcheck
make -C ../../src/test/regress pg_regress
make[1]: `pg_regress' is up to date.
/bin/sh ../../src/test/regress/pg_regress --dbname=contrib_regression
cube
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
============== dropping regression test user accounts ==============
============== running regression test queries ==============
test cube ... FAILED

======================
1 of 1 tests failed.
======================

I have tried this both on OS X and Linux and get similar results.

Josh Reich

Neil Conway wrote:

On Mon, 2006-07-17 at 17:55 -0400, Joshua Reich wrote:

Ok. So, the cube code looks very unmaintained (not to offend
anyone), but it is all in V0 and I believe make installcheck fails
out of the box due to new error message formats.

It passes for me with CVS HEAD. The cube regression test is also run as
part of the buildfarm process, so it sounds like an error on your end.

------------------------------------------------------------------------

*** ./expected/cube_1.out	Sun Jun 26 21:19:43 2005
--- ./results/cube.out	Tue Jul 18 09:44:14 2006
***************
*** 258,310 ****
-- invalid input: parse errors
SELECT ''::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT 'ABC'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "A"
SELECT '()'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '[]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[()]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '[(1)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[(1),]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[(1),2]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '1,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT '1,2,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT '1,,2'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '(1,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '(1,2,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '(1,,2)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
-- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
--- 258,310 ----
-- invalid input: parse errors
SELECT ''::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT 'ABC'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "A"
SELECT '()'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '[]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[()]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '[(1)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[(1),]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[(1),2]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '1,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT '1,2,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT '1,,2'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '(1,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '(1,2,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '(1,,2)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
-- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
***************
*** 313,319 ****
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1),(2),'::cube AS cube; -- 2
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
--- 313,319 ----
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1),(2),'::cube AS cube; -- 2
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
***************
*** 322,346 ****
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '1..2'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ".2"
--
-- Testing building cubes from float8 values
--
--- 322,346 ----
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  parse error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  parse error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '1..2'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  parse error at or near ".2"
--
-- Testing building cubes from float8 values
--

======================================================================

------------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

#7Joshua Reich
josh@root.net
In reply to: Andrew Dunstan (#6)
Re: [PATCHES] Proposed patch for contrib/cube

I upgraded to the latest version (2.3) as per the warning after running
configure.

Josh

Andrew Dunstan wrote:

What version of bison do you have?

cheers

andrew

Joshua Reich wrote:

I have completed upgrading the cube codebase to use the V1 call
protocol. However, before I submit a patch I would really like to work
out why I have never been able to get cube to pass installcheck.

This is what I get when I run installcheck on a clean version of 8.1.4
(I get similar results on CVS HEAD). The regression.diff is attached.

josh:~/installs/postgresql-8.1.4/contrib/cube josh$ make installcheck
make -C ../../src/test/regress pg_regress
make[1]: `pg_regress' is up to date.
/bin/sh ../../src/test/regress/pg_regress --dbname=contrib_regression
cube
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
============== dropping regression test user accounts ==============
============== running regression test queries ==============
test cube ... FAILED

======================
1 of 1 tests failed.
======================

I have tried this both on OS X and Linux and get similar results.

Josh Reich

Neil Conway wrote:

On Mon, 2006-07-17 at 17:55 -0400, Joshua Reich wrote:

Ok. So, the cube code looks very unmaintained (not to offend
anyone), but it is all in V0 and I believe make installcheck fails
out of the box due to new error message formats.

It passes for me with CVS HEAD. The cube regression test is also run as
part of the buildfarm process, so it sounds like an error on your end.

------------------------------------------------------------------------

*** ./expected/cube_1.out    Sun Jun 26 21:19:43 2005
--- ./results/cube.out    Tue Jul 18 09:44:14 2006
***************
*** 258,310 ****
-- invalid input: parse errors
SELECT ''::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT 'ABC'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "A"
SELECT '()'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '[]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[()]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '[(1)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[(1),]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[(1),2]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '1,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT '1,2,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT '1,,2'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '(1,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '(1,2,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '(1,,2)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
-- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
--- 258,310 ----
-- invalid input: parse errors
SELECT ''::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT 'ABC'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "A"
SELECT '()'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '[]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[()]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '[(1)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[(1),]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[(1),2]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '1,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT '1,2,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT '1,,2'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '(1,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '(1,2,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '(1,,2)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
-- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
***************
*** 313,319 ****
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1),(2),'::cube AS cube; -- 2
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
--- 313,319 ----
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1),(2),'::cube AS cube; -- 2
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
***************
*** 322,346 ****
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '1..2'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ".2"
--
-- Testing building cubes from float8 values
--
--- 322,346 ----
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  parse error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  parse error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '1..2'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  parse error at or near ".2"
--
-- Testing building cubes from float8 values
--

======================================================================

------------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

--
Joshua Reich
Finance and Corporate Development
ROOT Exchange, A Division of ROOT Markets
601 W. 26th St. / Suite 1500
New York, NY 10001
W - (212) 645 6320 x 7101
M / T - (646) 427 7959
E - josh@rootexchange.com

#8Andrew Dunstan
andrew@dunslane.net
In reply to: Joshua Reich (#7)
Re: [PATCHES] Proposed patch for contrib/cube

Then maybe you need to remove cubeparse.[ch] and try again. Bison
changed the error message from "parse error" to "syntax error" in
version 1.875 and it has been the same ever since, AFAIK.

cheers

andrew

Joshua Reich wrote:

Show quoted text

I upgraded to the latest version (2.3) as per the warning after
running configure.

Josh

Andrew Dunstan wrote:

What version of bison do you have?

cheers

andrew

Joshua Reich wrote:

I have completed upgrading the cube codebase to use the V1 call
protocol. However, before I submit a patch I would really like to
work out why I have never been able to get cube to pass installcheck.

This is what I get when I run installcheck on a clean version of
8.1.4 (I get similar results on CVS HEAD). The regression.diff is
attached.

josh:~/installs/postgresql-8.1.4/contrib/cube josh$ make installcheck
make -C ../../src/test/regress pg_regress
make[1]: `pg_regress' is up to date.
/bin/sh ../../src/test/regress/pg_regress
--dbname=contrib_regression cube
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
============== dropping regression test user accounts ==============
============== running regression test queries ==============
test cube ... FAILED

======================
1 of 1 tests failed.
======================

I have tried this both on OS X and Linux and get similar results.

Josh Reich

Neil Conway wrote:

On Mon, 2006-07-17 at 17:55 -0400, Joshua Reich wrote:

Ok. So, the cube code looks very unmaintained (not to offend
anyone), but it is all in V0 and I believe make installcheck fails
out of the box due to new error message formats.

It passes for me with CVS HEAD. The cube regression test is also
run as
part of the buildfarm process, so it sounds like an error on your end.

------------------------------------------------------------------------

*** ./expected/cube_1.out    Sun Jun 26 21:19:43 2005
--- ./results/cube.out    Tue Jul 18 09:44:14 2006
***************
*** 258,310 ****
-- invalid input: parse errors
SELECT ''::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT 'ABC'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "A"
SELECT '()'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '[]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[()]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '[(1)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[(1),]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "]"
SELECT '[(1),2]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '1,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT '1,2,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at end of input
SELECT '1,,2'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '(1,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '(1,2,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ")"
SELECT '(1,,2)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
-- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
--- 258,310 ----
-- invalid input: parse errors
SELECT ''::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT 'ABC'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "A"
SELECT '()'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '[]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[()]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '[(1)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[(1),]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "]"
SELECT '[(1),2]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '1,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT '1,2,'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at end of input
SELECT '1,,2'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '(1,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '(1,2,)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ")"
SELECT '(1,,2)'::cube AS cube;
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
-- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
***************
*** 313,319 ****
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1),(2),'::cube AS cube; -- 2
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
--- 313,319 ----
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1),(2),'::cube AS cube; -- 2
ERROR:  bad cube representation
! DETAIL:  parse error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR:  bad cube representation
DETAIL:  different point dimensions in (1,2,3) and (2,3)
***************
*** 322,346 ****
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  syntax error at or near "a"
SELECT '1..2'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  syntax error at or near ".2"
--
-- Testing building cubes from float8 values
--
--- 322,346 ----
DETAIL:  different point dimensions in (1,2) and (1,2,3)
SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5
ERROR:  bad cube representation
! DETAIL:  parse error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6
ERROR:  bad cube representation
! DETAIL:  parse error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  parse error at or near "a"
SELECT '1..2'::cube AS cube; -- 7
ERROR:  bad cube representation
! DETAIL:  parse error at or near ".2"
--
-- Testing building cubes from float8 values
--

======================================================================

------------------------------------------------------------------------

---------------------------(end of
broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joshua Reich (#7)
Re: [PATCHES] Proposed patch for contrib/cube

Joshua Reich <josh@root.net> writes:

Andrew Dunstan wrote:

What version of bison do you have?

I upgraded to the latest version (2.3) as per the warning after running
configure.

Better look again, because you definitely seem to be using an old bison
to build cubeparse.c.

regards, tom lane

#10Joshua Reich
josh@root.net
In reply to: Tom Lane (#9)
Re: [PATCHES] Proposed patch for contrib/cube

I just downgraded from 2.3 to 1.875 and rebuilt everything, and now it
works fine.

As per Andrew's previous email, in 2.3 the error messages were changed
from "parse error" to "syntax error", causing the diff to fail.

Josh

Tom Lane wrote:

Joshua Reich <josh@root.net> writes:

Andrew Dunstan wrote:

What version of bison do you have?

I upgraded to the latest version (2.3) as per the warning after running
configure.

Better look again, because you definitely seem to be using an old bison
to build cubeparse.c.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

--
Joshua Reich
Finance and Corporate Development
ROOT Exchange, A Division of ROOT Markets
601 W. 26th St. / Suite 1500
New York, NY 10001
W - (212) 645 6320 x 7101
M / T - (646) 427 7959
E - josh@rootexchange.com