[SQL] Limited number of polygon function arguments

2007-08-17 Thread Franz Mühlbauer
Hi,

the polygon function seems to be limited to
approximately 100 point arguments but some of my
polygons consist of more than 100 points. Are there
any hacks to get around of these limitations? Or do I
really have to install postGIS to deal with such
polygons?

(I am using PostgreSQL 8.1.9 on a Linux box)

Thanks
Franz Muehlbauer, Munich, Germany



  Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER HEIMWERKER! 
www.yahoo.de/clever

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

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


[SQL] Sequences problem

2007-08-17 Thread Judith

Hello everybody, I have a question related with sequences.

When I init a sesion with my db, if a do the next sentence:

   SELECT   currval('pagos_id_pago_seq');


return this:
  ERROR: the relation doesn't exist
   (or somethimg like that, because the message is in spanish)

but if I do first,

   SELECT nextval('pagos_id_pago_seq');

and then
   SELECT currval('pagos_id_pago_seq');   it success, returns the 
current sequence value,  it is possible to indicate that the sequence is 
already started and in the value 4567 but I need first to now the 
current value before the next, how can I do?


   Thanks in advanced


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


Re: [SQL] Sequences problem

2007-08-17 Thread Andrew Sullivan
On Fri, Aug 17, 2007 at 04:33:04PM -0500, Judith wrote:
> When I init a sesion with my db, if a do the next sentence:
> 
>SELECT   currval('pagos_id_pago_seq');
> 
> 
> return this:
>   ERROR: the relation doesn't exist
>(or somethimg like that, because the message is in spanish)

You _must_ call nextval() before a currval().  This is documented
behaviour.

A

-- 
Andrew Sullivan  | [EMAIL PROTECTED]
The whole tendency of modern prose is away from concreteness.
--George Orwell

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] Sequences problem

2007-08-17 Thread Scott Marlowe
On 8/17/07, Judith <[EMAIL PROTECTED]> wrote:
> Hello everybody, I have a question related with sequences.
>
> When I init a sesion with my db, if a do the next sentence:
>
> SELECT   currval('pagos_id_pago_seq');
>
>
> return this:
>ERROR: the relation doesn't exist
> (or somethimg like that, because the message is in spanish)
>
> but if I do first,
>
> SELECT nextval('pagos_id_pago_seq');
>
> and then
> SELECT currval('pagos_id_pago_seq');   it success, returns the
> current sequence value,  it is possible to indicate that the sequence is
> already started and in the value 4567 but I need first to now the
> current value before the next, how can I do?

Sorry, that's not how sequences work.

Have you read the manual on sequence manipulation?

http://www.postgresql.org/docs/8.2/static/functions-sequence.html

Sequences are designed to allow fast access to sequentially increasing
numbers to use as identifiers in the database.  While they guarantee
no repeats (unless you set them to roll over etc...) they don't
guarantee no gaps.

so, the current value only has context if you've actually pulled a
sequence from the generator, otherwise what it is right now isn't
really important yet.

There are some functions you can use to get the current number, but
doing that is not safe from race conditions, so you should only do
that stuff while access to the db is shut off to other users.

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [SQL] Limited number of polygon function arguments

2007-08-17 Thread Tom Lane
=?iso-8859-1?q?Franz=20M=FChlbauer?= <[EMAIL PROTECTED]> writes:
> the polygon function seems to be limited to
> approximately 100 point arguments

Surely not.  Please provide a concrete example of your problem.

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[SQL] Join query help

2007-08-17 Thread novice
Hi, We have the following three tables.

safety=> SELECT record_id, record_date FROM record;
 record_id |  record_date
---+
 1 | 2007-07-23 11:30:37+10
 2 | 2007-07-27 11:30:14+10
 3 | 2007-07-17 13:15:03+10
(3 rows)

safety=> SELECT observation_id, record_id, score_id FROM observation;
 observation_id | record_id | score_id
+---+--
   3240 | 1 |1
   3239 | 1 |1
   3238 | 1 |2
   3237 | 1 |1
   2872 | 2 |1
   2869 | 2 |2
   2870 | 2 |1
   2871 | 2 |1
   3218 | 3 |2
   3217 | 3 |1
(10 rows)

safety=> SELECT * FROM SCORE;
 score_id | score_description
--+---
0 | NA
1 | SAFE
2 | AT RISK
(3 rows)


What query do I write to generate the following?

week_no | count(record_id | count(observation_id) | sum(score_id) where = '1'
2007, 30  |   2   |   8   |   6
2007, 29  |   1   |   2   |   1

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