[GENERAL] -devel files

2012-01-15 Thread Graeme Gemmill
I intend to compile Postgresql 9.1.2 for my particular machine and also 
need the -devel files.
I can't see any reference to them in the download libraries. Could sone 
kind soul tell me where they are please?

Thanks
--
Grimble
Registered Linux User #450547
Running KDE 4.6.5  on 2.6.39.4-4.2-desktop kernel.
Mandriva Linux release 2011.0 (Official) for i586


Re: [GENERAL] how to make select for multiunit

2012-01-15 Thread Misa Simic
Hi,

I have understood he does not want to round...

I would make custom type myUofM
KRT int, PAK int, PCS int

Then function to_myUofM which has 1 input parametar as int, and returns
myUofM, (imutable func)


so SELECT to_myUofM(25) returns
0,2,5

25 PCS is 0 KRT, 2 PAK and 5 PCS

Then query:

SELECT name, to_myUofM(qty).KRT, myUofM(qty).PAK, myUofM(qty).PCS FROM
stocks


Kind Regards,

Misa

Sent from my Windows Phone
--
From: Rene Romero Benavides
Sent: 15/01/2012 05:26
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] how to make select for multiunit

  On 01/14/2012 09:22 PM, plasmasoftware net wrote:

hello ...
i have stock table all stock in smallest unit ( PCS )

i have stock table like this

name qty  unit
PCA   20   PCS
MOUSE  25 PCS


i have table unit
1 KRT = 12 PAK
1 PAK = 10 PCS

how to make select to display report stok in dbGRID like this :

PCA 2 KRT 0 PAK 0 PCS
MOUSE 0 KRT 2 PAK 1 PCS

I don't understand,

Wouldn't have been:
PCA 0 KRT 2 PAK 20 PCS
MOUSE 0 KRT 2 PAK 25 PCS
?

anyways, if the "units" table was something like this :

unit convUnit ratio
PCS PCS  1
PCS KRT   1/120
PCS PAK   1/10
(foreseeing other types of conversions)

One simple solution  is:
SELECT s.name, (select s.qty * ratio FROM unit   WHERE unit='PCS' and
conv='KRT'), ' KRT ',
  (select s.qty * ratio FROM unit   WHERE
unit='PCS' and conv='PAK'), ' PAK ',
  s.qty, ' PCS'
 FROM stock s;

rounding or truncating is up to you.

-- 
 http://sharingtechknowledge.blogspot.com/


Re: [GENERAL] -devel files

2012-01-15 Thread Adrian Klaver
On Sunday, January 15, 2012 8:17:19 am Graeme Gemmill wrote:
> I intend to compile Postgresql 9.1.2 for my particular machine and also
> need the -devel files.
> I can't see any reference to them in the download libraries. Could sone
> kind soul tell me where they are please?

Are you downloading the source code or one of the binary packages?
If the source code then it contains the dev files for itself. You may need to 
download dev packages for libraries it links against i.e readline, ssl, 
Python,etc. This depends on the compile options you choose.

> Thanks

-- 
Adrian Klaver
adrian.kla...@gmail.com

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] HELP, how to make this query.

2012-01-15 Thread plasmasoftware net
*select j.kode_barang kode_barang,j.isi_Satuan from J_master_barang j **order
by j.kode_barang asc*
*display *
kode isi
01 24
01B 12
01C 1

i want to make that become when i select my table.how to make this.

kode   isi_A isi_Bisi_C
01  24121


Re: [GENERAL] HELP, how to make this query.

2012-01-15 Thread Raghavendra
On Sun, Jan 15, 2012 at 12:17 PM, plasmasoftware net <
administra...@plasmasoftware.net> wrote:

> *select j.kode_barang kode_barang,j.isi_Satuan from J_master_barang j **order
> by j.kode_barang asc*
> *display *
> kode isi
> 01 24
> 01B 12
> 01C 1
>
> i want to make that become when i select my table.how to make this.
>
> kode   isi_A isi_Bisi_C
> 01  24121
>

I think you have to use crosstab, you can try this out...

select '0001' as Kode, sum(case when j.kode_barang='A' then isi
else 0 end) as isi_A,
   sum(case when
j.kode_barang='B' then isi else 0 end) as isi_B,
   sum(case when
j.kode_barang='C' then isi else 0 end) as isi_C from j_master_barang;

---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/


Re: [GENERAL] How to return latest results without a polygon intersect?

2012-01-15 Thread David Waddy
 Thank-you for the help.

I defined the problem a little better and took your advice and asked in
postgis users:
http://www.postgis.org/pipermail/postgis-users/2012-January/032056.html

Dave


On Wed, Jan 11, 2012 at 11:20 PM, Andy Colson  wrote:

> On 01/11/2012 07:14 PM, David Waddy wrote:
>
>> If I have a table of the following form:
>>
>> id (integer)   event_time  (timestamp)   lat_lon (polygon)
>> 3497 1977-01-01 00:00:00
>> ((-64.997,45.975),(,(-64.9981,**45.975),(-64.8981,45.875),(-**
>> 64.9978,45.9751))
>> 3431 2007-06-06 01:00:00
>> ((-64.971,45.982),(-64.921,45.**982),(-64.972,45.982),(-64.**
>> 973,45.98209),(-64.97,45.**98237))
>> 3498 1977-01-01 00:00:00
>> ((-64.97838,45.9778),(-64.**9783,45.97767),(-64.978,45.**
>> 977),(-64.9781,45.97728),(-64.**9781,45.97714),(-64.977,45.**976))
>> ...
>>
>> How would I return a list of the latest events for a particular
>> lat/lon region? More precisely, how would a return a result set with
>> the greatest event times with polygons that don't intersect any other
>> polygon in the result set?
>>
>> Any help would be greatly appreciated,
>> Dave
>>
>>
> Are you using PostGIS?  Assuming yes, try something like:
>
> select * from theTable a cross join theTable b on not (a.lat_lon &&
> b.lat_lon) order by event_time
>
> Also try the postgis news group, there are people there with more
> experience with the postGIS functions.
>
> Your two questions dont seem to be asking the same thing, though.  One
> asks for a particular region.  The second for a region that doesn't
> intersect with any other's.  I went for the second, cross joining the table
> to itself, so every record with be compared to every other record, which is
> gonna be a huge number of comparisons.  So it'll be slow.
>
> -Andy
>



-- 
David Waddy
Waddy & Colpitts Ltd.
99 Milky Way
Colpitts Settlement, NB
E4J 0B6 Canada
tel: 506-372-4564
http://www.littleriver.ca


[GENERAL] Repercussions of Cancelled Autovacuum

2012-01-15 Thread Andrew Hannon
Hello,

We have a large(ish) table that had a series of delete statements executed 
against it (culling most of the rows in the table). This triggered a time 
consuming autovacuum, which we allowed to run for 2+ days (and were planning to 
allow to run to completion). However, it ended up getting cancelled 
unexpectedly, and is now running once again. I have some questions:

1. My understanding is the autovacuum will block most (all?) DDL statements 
executed on it, and pg will cancel it if a user requests a conflicting lock. I 
don't believe either of these things occurred. Are there any other 
circumstances that will cancel an autovacuum?
2. Is autovacuum incremental? Or, does it effectively roll back and start 
fresh, having to redo all of the work of the last couple of days?

Thank you!

Andrew
-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general