Re: [SQL] returning a recordset from PLpg/SQL

2004-03-01 Thread Terence Kearns
Tom Lane wrote: > Terence Kearns <[EMAIL PROTECTED]> writes: > >>I tried >>RETURNS SETOF RECORD >>but that doesn't work > > > Sure it does, if you use it correctly. Better show us what you did. > >regards, tom lane Well I haven't yet done anything because I couldn't get anythin

Re: [SQL] returning a recordset from PLpg/SQL

2004-03-01 Thread Stephan Szabo
On Tue, 2 Mar 2004, Terence Kearns wrote: > Tom Lane wrote: > > Terence Kearns <[EMAIL PROTECTED]> writes: > > > >>I tried > >>RETURNS SETOF RECORD > >>but that doesn't work > > > > > > Sure it does, if you use it correctly. Better show us what you did. > > > >regard

Re: [SQL] User defined types -- Social Security number...

2004-03-01 Thread Dana Hudes
I would represent an SSN as numeric(9,0). an int 32 would work though. 2**31 is > 9 On Sun, 29 Feb 2004, Christopher Browne wrote: > The world rejoiced as [EMAIL PROTECTED] (Michael Chaney) wrote: > > Look, you're thinking way too hard on this. An SSN is a 9-digit number, > > nothing mor

Re: [SQL] returning a recordset from PLpg/SQL

2004-03-01 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Tue, 2 Mar 2004, Terence Kearns wrote: >> Well I haven't yet done anything because I couldn't get anything to >> compile which returned SETOF RECORD.. > As a starting point, SETOF "RECORD" is different from SETOF RECORD given > PostgreSQL's fold case

Re: [SQL] User defined types -- Social Security number...

2004-03-01 Thread Steve Crawford
On Monday 01 March 2004 8:54 am, Dana Hudes wrote: > I would represent an SSN as numeric(9,0). > an int 32 would work though. > 2**31 is > 9 > > On Sun, 29 Feb 2004, Christopher Browne wrote: > > The world rejoiced as [EMAIL PROTECTED] (Michael Chaney) wrote: > > > Look, you're thinking wa

Re: [SQL] returning a recordset from PLpg/SQL

2004-03-01 Thread Joe Conway
Tom Lane wrote: Stephan Szabo <[EMAIL PROTECTED]> writes: On Tue, 2 Mar 2004, Terence Kearns wrote: Well I haven't yet done anything because I couldn't get anything to compile which returned SETOF RECORD.. As a starting point, SETOF "RECORD" is different from SETOF RECORD given PostgreSQL's fold c

[SQL] SYSDATE in PostgreSQL !?

2004-03-01 Thread Louie Kwan
How can I define a table with columns with sysdate as the default value.. If there is no SYSDATE defined in PostgreSQL , what can I do ? Any help is appreciated. CREATE TABLE channels( channelID NUMBER PRIMARY KEY, name VARCHAR2(64) NOT NULL, sta

Re: [SQL] User defined types -- Social Security number...

2004-03-01 Thread Michael Chaney
On Mon, Mar 01, 2004 at 09:42:48AM -0800, Steve Crawford wrote: > I missed the start of this thread but will chime in with a comment > anyway. > > My rule is to select an appropriate numeric type of data if you will > be doing numeric types of things to it, character types if you will > be doin

[SQL] select by groups

2004-03-01 Thread Martin Marques
I have a table with names of people, email address, etc, and an identifier that tells me which group they are in (could be a 1, 2, or 3 person group). Is it posible to make a query that would give me the name of the persons of each group in one row? Or do I have to do PL? -- 19:15:01 up 97 da

Re: [SQL] select by groups

2004-03-01 Thread Manuel Sugawara
Martin Marques <[EMAIL PROTECTED]> writes: > I have a table with names of people, email address, etc, and an identifier > that tells me which group they are in (could be a 1, 2, or 3 person group). > Is it posible to make a query that would give me the name of the persons of > each group in one

Re: [SQL] SYSDATE in PostgreSQL !?

2004-03-01 Thread Oliver Elphick
On Mon, 2004-03-01 at 21:18, Louie Kwan wrote: > How can I define a table with columns with sysdate as the default value.. > > If there is no SYSDATE defined in PostgreSQL , what can I do ? > CREATE TABLE channels( ... > updateTimeStamp DATE default (SYSDATE), > createTimeStamp D

Re: [SQL] returning a recordset from PLpg/SQL

2004-03-01 Thread Terence Kearns
Tom Lane wrote: > Stephan Szabo <[EMAIL PROTECTED]> writes: > >> On Tue, 2 Mar 2004, Terence Kearns wrote: >> >>> Well I haven't yet done anything because I couldn't get anything to >>> compile which returned SETOF RECORD.. > > > >> As a starting point, SETOF "RECORD" is different from SETOF RECOR

Re: [SQL] returning a recordset from PLpg/SQL

2004-03-01 Thread Terence Kearns
I've read through all the example code you've provided thoroughly and there are definately some useful ideas there. I changed the design of the document_attribute_values table to only have one field, a text field, to store the value. As your examples demosntrates, I can simply cast the text val

[SQL] scripts for converting postgres to oracle?

2004-03-01 Thread Terence Kearns
Hi there, We use oracle at work but I use postgres at home. I also sometimes develop something in postgres for use at work because I don't really want to run oracle (9i Lite won't install) on my laptop. At the moment, I'm hacking a nasty php script which converts a pgdump file which will work f

Re: [SQL] User defined types -- Social Security number...

2004-03-01 Thread Michael Chaney
On Sun, Feb 29, 2004 at 11:11:31PM -0500, Christopher Browne wrote: > The world rejoiced as [EMAIL PROTECTED] (Michael Chaney) wrote: > > Look, you're thinking way too hard on this. An SSN is a 9-digit number, > > nothing more. There are some 9-digit numbers which aren't valid SSN's, > > and you

[SQL] What's wrong with my date/interval arithmetic?

2004-03-01 Thread Wojtek
Hi, I ran this query on Postgres 7.3: select min_time, max_time, min_time+age(max_time,min_time) as result, to_timestamp('2003-10-17 23:07:00','-MM-dd HH24:MI:SS') +age(to_timestamp('2003-12-01 03:50:45','-MM-dd HH24:MI:SS'), to_timestamp('2003-10-17 23:07:00','-M

Re: [SQL] What's wrong with my date/interval arithmetic?

2004-03-01 Thread Tom Lane
Wojtek <[EMAIL PROTECTED]> writes: > Why is the "result" incorrect (off by one day)? > When I do the exactly same arithmetic using timestamps created > with to_timestamp, everything is OK ("expected_result"). It is not "exactly the same arithmetic", because to_timestamp delivers a result of type t

Re: [SQL] What's wrong with my date/interval arithmetic?

2004-03-01 Thread Wojtek
TL> It is not "exactly the same arithmetic", because to_timestamp TL> delivers a result of type timestamp-with-time-zone, whereas your TL> other values are evidently timestamp without time zone. You did TL> not say what timezone setting you are using, but I think the TL> discrepancy