Thomas Kellerer | 1 Apr 2003 11:53
Picon

Re: create view with numeric data

Haven't tried it, but if you casted the result of the sum to 
numeric(9,2)? Btw: does the ELSE '0' really work? It seems a bit strange 
to put a string into a SUM...

cast ( sum(CASE WHEN month='01' THEN budgetvalue ELSE 0 END) as 
numeric(9,2)) AS january

Thomas

cio198 schrieb:
> Hello, 
> 
> i've created this table
> 
> CREATE TABLE "budget" (
>         "year" character varying NOT NULL,
>         "month" character varying NOT NULL,
>         "accountno" character varying NOT NULL,
>         "costid" character varying NOT NULL,
>         "valutacode" character varying,
>         "budgetvalue" numeric(9,2) DEFAULT '0',
>         "deptname" character varying,
>         Constraint "budget_pkey" Primary Key ("year", "month",
> "accountno", "costid")
> );
> 
> And I want to create the a view using query bellow.
> The problem is the numeric data in the view isn't limited to
> numeric(9,2) instead it become numeric(65535, 65531).
> Is there any way i can restrict it to numeric (9,2)
(Continue reading)

Luis Mix | 1 Apr 2003 16:34
Picon
Favicon

How can I quit this: "Unique " to my table?

Hello pgsql-sql,

  When my table was create I wrote this:

  MyDatabase=# create table b_prestamo(no_inventa char(16) unique not
  null, cve_area char(10), date1 date);
  I need now that my table can accept repeated records, but not Null.
  How can I do that?
  SomeBody can help me please?
  My table has information at the moment,what can I do for maintain
  it?

--

-- 
Best regards,
 Luis                          mailto:ksql2002 <at> yahoo.com.mx

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

Achilleus Mantzios | 1 Apr 2003 21:26

Re: How can I quit this: "Unique " to my table?

On Tue, 1 Apr 2003, Luis Mix wrote:

> Hello pgsql-sql,
> 
>   When my table was create I wrote this:
> 
>   MyDatabase=# create table b_prestamo(no_inventa char(16) unique not
>   null, cve_area char(10), date1 date);
>   I need now that my table can accept repeated records, but not Null.
>   How can I do that?
>   SomeBody can help me please?
>   My table has information at the moment,what can I do for maintain
>   it?

drop index b_prestamo_no_inventa_idx;

>   
>   
> 
> 

--

-- 
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
(Continue reading)

Achilleus Mantzios | 1 Apr 2003 21:29

Re: How can I quit this: "Unique " to my table?

On Tue, 1 Apr 2003, Luis Mix wrote:

> Hello pgsql-sql,
> 
>   When my table was create I wrote this:
> 
>   MyDatabase=# create table b_prestamo(no_inventa char(16) unique not
>   null, cve_area char(10), date1 date);
>   I need now that my table can accept repeated records, but not Null.
>   How can I do that?
>   SomeBody can help me please?
>   My table has information at the moment,what can I do for maintain
>   it?

Sorry man :(

the correct statement is

ALTER TABLE b_prestamo drop constraint b_prestamo_no_inventa_key;

>   
>   
> 
> 

--

-- 
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
(Continue reading)

Ian Barwick | 1 Apr 2003 17:15
Picon

Re: How can I quit this: "Unique " to my table?

On Tuesday 01 April 2003 21:26, Achilleus Mantzios wrote:
> On Tue, 1 Apr 2003, Luis Mix wrote:
> > Hello pgsql-sql,
> >
> >   When my table was create I wrote this:
> >
> >   MyDatabase=# create table b_prestamo(no_inventa char(16) unique not
> >   null, cve_area char(10), date1 date);
> >   I need now that my table can accept repeated records, but not Null.
> >   How can I do that?
> >   SomeBody can help me please?
> >   My table has information at the moment,what can I do for maintain
> >   it?
>
> drop index b_prestamo_no_inventa_idx;

ALTER TABLE b_prestamo DROP CONSTRAINT b_prestamo_no_inventa_key ??

Ian Barwick
barwick <at> gmx.net

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

Oleg Bartunov | 1 Apr 2003 17:36
Picon

Re: Off topic : world database

On Tue, 1 Apr 2003, Bruno Wolff III wrote:

> On Tue, Apr 01, 2003 at 19:26:33 +0400,
>   Oleg Bartunov <oleg <at> sai.msu.su> wrote:
> > I don't know if it's legal to use data from
> > http://www.nima.mil/gns/html/index.html
> > but it's a huge collection of geo data.
>
> I found that as it was referenced from the calea site. And NIMA points
> to another US government site that contains data for the US and
> Antartica (which the NIMA site doesn't). These places seem to be a better
> place to get the data than calea since you can get the data in a smaller
> number of downloads and you don't have to extract the data from html.
> There is also location data for other kinds of objects besides populated
> places.

I already tried to play with data from NIMA and notice many problems
with parsing files to load into db. Also, russian names are in translit :-)

>

	Regards,
		Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg <at> sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

---------------------------(end of broadcast)---------------------------
(Continue reading)

Oleg Bartunov | 1 Apr 2003 17:26
Picon

Re: Off topic : world database

I don't know if it's legal to use data from
http://www.nima.mil/gns/html/index.html
but it's a huge collection of geo data.

	Oleg
On Mon, 31 Mar 2003, Bruno Wolff III wrote:

> On Mon, Mar 31, 2003 at 11:08:48 +0530,
>   Rajesh Kumar Mallah <mallah <at> trade-india.com> wrote:
> >
> > I am wanting to make an application similar to you
> >  which shud be able to  get all the places within certaint
> > radius of the place in  question.
>
> If you look at contrib/earthdistance in the 7.4 source tree, there is
> a varient way to use earthdistance based on the cube data type instead
> of point. This varient uses a 3D representation so you don't have to
> worry about issues at the poles or wrap around. You can do indexed
> searches (though I don't really know how well (fast) the indexes work,
> since I haven't tried them with large amounts of data) inside of
> bounding boxes, then double check that the points are really closer
> than the desired distance.
>
> This varient uses a couple of new cube functions and check constraints
> on domains. You can just comment out the check constraints. The 7.4
> contrib/cube might work with 7.3. (If there are problems you should
> be able to compare with the 7.3 version to figure out how to make it
> work.)
>
> P.S.
(Continue reading)

Bruno Wolff III | 1 Apr 2003 17:32
Picon

Re: Off topic : world database

On Tue, Apr 01, 2003 at 19:26:33 +0400,
  Oleg Bartunov <oleg <at> sai.msu.su> wrote:
> I don't know if it's legal to use data from
> http://www.nima.mil/gns/html/index.html
> but it's a huge collection of geo data.

I found that as it was referenced from the calea site. And NIMA points
to another US government site that contains data for the US and
Antartica (which the NIMA site doesn't). These places seem to be a better
place to get the data than calea since you can get the data in a smaller
number of downloads and you don't have to extract the data from html.
There is also location data for other kinds of objects besides populated
places.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Jeff Hoffmann | 1 Apr 2003 17:53

Re: Off topic : world database

Oleg Bartunov wrote:
> I don't know if it's legal to use data from
> http://www.nima.mil/gns/html/index.html
> but it's a huge collection of geo data.

It appears to be completely free.  I don't work there so this isn't an 
official response, but here's one of the questions from their FAQ:

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

Q: We are interested in exploring the possibility of adding content from 
geonames files to our existing geographical databases. Can we proceed to 
download and use files? Is there a cost for this and are there 
restrictions on the use to which we can put the data?

A: There is no problem in making the geographic names data freely 
available. A suitable citation note is:

Toponymic information is based on the Geographic Names Data Base, 
containing official standard names approved by the United States Board 
on Geographic Names and maintained by the National Imagery and Mapping 
Agency. More information is available at the Maps and Geodata link at 
www.nima.mil. The National Imagery and Mapping Agency name, initials, 
and seal are protected by 10 United States Code Section 445.

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

I would assume that means it's free for any use providing you include 
appropriate credits as they suggest.

(Continue reading)

Tom Lane | 1 Apr 2003 18:12
Picon

Re: How can I quit this: "Unique " to my table?

Ian Barwick <barwick <at> gmx.net> writes:
> On Tuesday 01 April 2003 21:26, Achilleus Mantzios wrote:
>> drop index b_prestamo_no_inventa_idx;

> ALTER TABLE b_prestamo DROP CONSTRAINT b_prestamo_no_inventa_key ??

The correct answer is "one or the other depending on which PG version
he's running" ;-).  Before 7.3, drop the index; as of 7.3 you're
supposed to drop the constraint instead.  (No harm in trying the wrong
one, it just won't let you do it.)

Looking at the output of psql's "\d b_prestamo" would be a good idea to
verify the spelling of the index and/or constraint name.

			regards, tom lane

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


Gmane