[SQL] Proper entry of polygon type data

2009-03-24 Thread Peter Willis
Hello, I would like to use 'polygon' type data and am wondering about the entry format of the vertex coordinates. Are the coordinates of the polygon type to be entered one entry per polygon vertex, or one entry per polygon edge segment? For example: I have a triangle with vertex corners A, B, C

Re: [SQL] Alter Table/Indexing

2009-03-24 Thread Tom Lane
Zdravko Balorda writes: > I wonder does ATER TABLE TYPE, SET, depends on indexes, like INSERT does > in a sense it may be faster to drop and recreate index than sorting > after every row inserted. ALTER TABLE TYPE already rebuilds the indexes; you won't make the overall process any faster by doi

[SQL] Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps

2009-03-24 Thread Jasen Betts
On 2009-03-17, Srikanth wrote: > Dear all, > > I have a table that records User Login Sessions with two timestamp fields. = > Basically Start of Session and End of a Session (start_ts and end_ts). Each= > row in the table identifies a session which a customer has used.=A0=20 > > > I have to find

Re: [SQL] cast bool/int

2009-03-24 Thread Jasen Betts
On 2009-03-23, Zdravko Balorda wrote: > > Hi, > I need a casting operator from boolean to integer, you can use any expression > tu put in ALTER TABLE statment after USING. > > Any ideas? Thanks. CASE WHEN columname THEN 1 WHEN NOT columname THEN 0 ELSE NULL END -- Sent via pgsql-sql m

Re: [SQL] alter table on a large db

2009-03-24 Thread Jasen Betts
On 2009-03-19, Zdravko Balorda wrote: > > Hi, > > I need to make some ALTER TABLEs. It takes about 30min to copy > this quite large databse, bat several ours to run a bunch of ALTER > TABLE statements. which do you prefer 30 minutes down-time to reload the database or a few hours wait to update i

[SQL] Alter Table/Indexing

2009-03-24 Thread Zdravko Balorda
Hi, I wonder does ATER TABLE TYPE, SET, depends on indexes, like INSERT does in a sense it may be faster to drop and recreate index than sorting after every row inserted. Does changing type or setting default on an indexed column require sorting? Thanks, Zdravko -- Sent via pgsql-sql mail