Обсуждение: line datatype

Поиск
Список
Период
Сортировка

line datatype

От
Tim Hart
Дата:
Probably the most succinct explanation would be to copy & paste from the 
terminal...

tjhart=> create table a_line( foo line );
CREATE
tjhart=> insert into a_line ( foo ) values( '(0,0), (1,1)' );
ERROR:  line not yet implemented
tjhart=> select version();                               version
--------------------------------------------------------------------- PostgreSQL 7.2.1 on powerpc-apple-darwin5.3,
compiledby GCC 2.95.2
 
(1 row)


The documentation (datatype-geometric.html) indicates both a 'line' type 
and an 'lseg' type in the summary table at the top of the page. The same 
code above using the type 'lseg' in place of 'line' works just fine.

Why can I create a table with a column of type 'line' if I can't insert 
into it?



Re: line datatype

От
Bruce Momjian
Дата:
Tim Hart wrote:
> Probably the most succinct explanation would be to copy & paste from the 
> terminal...
> 
> tjhart=> create table a_line( foo line );
> CREATE
> tjhart=> insert into a_line ( foo ) values( '(0,0), (1,1)' );
> ERROR:  line not yet implemented
> tjhart=> select version();
>                                 version
> ---------------------------------------------------------------------
>   PostgreSQL 7.2.1 on powerpc-apple-darwin5.3, compiled by GCC 2.95.2
> (1 row)
> 
> 
> The documentation (datatype-geometric.html) indicates both a 'line' type 
> and an 'lseg' type in the summary table at the top of the page. The same 
> code above using the type 'lseg' in place of 'line' works just fine.
> 
> Why can I create a table with a column of type 'line' if I can't insert 
> into it?

Well, that's a very good question.  I see you have to compile PostgreSQL
with ENABLE_LINE_TYPE defined in pg_config.h.in  and rerun configure.

I see this commit from August 16, 1998:revision 1.35date: 1998/08/16 04:06:55;  author: thomas;  state: Exp;  lines: +7
-6Disablenot-ready-to-use support code for the line data type.Bracket things with #ifdef ENABLE_LINE_TYPE.The line data
typehas always been used internally to support other types, but I/O routines have never been defined for it.
 

psql \dT clearly shows line and lseg:
line                        | geometric line '(pt1,pt2)'lseg                        | geometric line segment
'(pt1,pt2)'

so I think we have both a documentation problem, psql problem, and code
problem.  Let's see what Thomas says.

For the short term, I would use lseg because it looks the same.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: line datatype

От
Bruce Momjian
Дата:
OK, I have added comments to \dT and SGML docs to mention that 'line' is
not implemented.  This should help future folks.

It would be nice to get the line type working 100%.  Thomas says the
problem is input/output format.  I don't completely understand.

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

Tim Hart wrote:
> Probably the most succinct explanation would be to copy & paste from the 
> terminal...
> 
> tjhart=> create table a_line( foo line );
> CREATE
> tjhart=> insert into a_line ( foo ) values( '(0,0), (1,1)' );
> ERROR:  line not yet implemented
> tjhart=> select version();
>                                 version
> ---------------------------------------------------------------------
>   PostgreSQL 7.2.1 on powerpc-apple-darwin5.3, compiled by GCC 2.95.2
> (1 row)
> 
> 
> The documentation (datatype-geometric.html) indicates both a 'line' type 
> and an 'lseg' type in the summary table at the top of the page. The same 
> code above using the type 'lseg' in place of 'line' works just fine.
> 
> Why can I create a table with a column of type 'line' if I can't insert 
> into it?
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026