[SQL] Table Relationships

2006-10-31 Thread Curtis Scheer
Given the following two tables:   CREATE TABLE public.task (   taskid int4 NOT NULL DEFAULT nextval('task_taskid_seq'::regclass),   description varchar,   CONSTRAINT pk_taskid PRIMARY KEY (taskid) )   public.users (   userid int4 NOT NULL,   username varchar,   CONSTRAINT pk_us

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread Richard Broersma Jr
> Thanks for your help. That does make sense, but I am not able to get the > result what I wanted > exactly. Let me explain you. > > I have ticks table in which I have columns like ric, tick_time, price & > volume. The times > table has just one column with times_time which has time data

Re: [SQL] Table Relationships

2006-10-31 Thread A. Kretschmer
am Tue, dem 31.10.2006, um 11:15:26 -0600 mailte Curtis Scheer folgendes: > Given the following two tables: > > CREATE TABLE public.task > ( > taskid int4 NOT NULL DEFAULT nextval('task_taskid_seq'::regclass), > description varchar, > CONSTRAINT pk_taskid PRIMARY KEY (taskid) > ) > > publi

Re: [SQL] Table Relationships

2006-10-31 Thread Aaron Bono
On 10/31/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am  Tue, dem 31.10.2006, um 11:15:26 -0600 mailte Curtis Scheer folgendes:> Given the following two tables:>> CREATE TABLE public.task> (>   taskid int4 NOT NULL DEFAULT nextval('task_taskid_seq'::regclass), >   description varchar,>   CONSTRAIN

[SQL] Round Numeric Type

2006-10-31 Thread Ezequias Rodrigues da Rocha
Hi list,I did a trigger to update a points on a table but in some cases the PostgreSQL does a round of my Numeric like.If >= 0.5 so postgresql puts 1If < 0.5 so postgresql puts 0Did anybody knows if it is possible to control this matter ? RegardsEzequias

Re: [HACKERS] [SQL] Case Preservation disregarding case

2006-10-31 Thread Stephan Szabo
On Tue, 31 Oct 2006, Chuck McDevitt wrote: > We treated quoted identifiers as case-specific, as the spec requires. > > In the catalog, we stored TWO columns... The column name with case > converted as appropriate (as PostgreSQL already does), used for looking > up the attribute, > And a second col

Re: [SQL] Table Relationships

2006-10-31 Thread A. Kretschmer
am Tue, dem 31.10.2006, um 13:32:59 -0600 mailte Aaron Bono folgendes: > I would go further by adding a type table like this: > > operation_type ( > operation_type_id bigserial (PK), You are sure, that you need bigserial? > This gives you the flexibility to add more operation types in the

Re: [SQL] Table Relationships

2006-10-31 Thread A. Kretschmer
am Tue, dem 31.10.2006, um 21:08:24 +0100 mailte A. Kretschmer folgendes: > am Tue, dem 31.10.2006, um 13:32:59 -0600 mailte Aaron Bono folgendes: > > I would go further by adding a type table like this: > > > > operation_type ( > > operation_type_id bigserial (PK), > > You are sure, that y

[SQL] record datatype comparisons

2006-10-31 Thread George Pavlov
I am trying to do some record comparisons using IS DISTINCT FROM and I feel like I am missing something. Basically comparisons between manually constructed records work as expected, but if I have a record returned by a select on one (or both sides) of the comparison I get errors "ERROR: operator do

Re: [SQL] Table Relationships

2006-10-31 Thread Aaron Bono
On 10/31/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am  Tue, dem 31.10.2006, um 21:08:24 +0100 mailte A. Kretschmer folgendes:> am  Tue, dem 31.10.2006, um 13:32:59 -0600 mailte Aaron Bono folgendes:> > I would go further by adding a type table like this: > >> > operation_type (> > operation_

Re: [SQL] Round Numeric Type

2006-10-31 Thread Andrew Sullivan
On Tue, Oct 31, 2006 at 05:35:17PM -0200, Ezequias Rodrigues da Rocha wrote: > Hi list, > > I did a trigger to update a points on a table but in some cases the > PostgreSQL does a round of my Numeric like. > > If >= 0.5 so postgresql puts 1 > If < 0.5 so postgresql puts 0 > > Did anybody knows i

Re: [SQL] record datatype comparisons

2006-10-31 Thread Andrew Sullivan
On Tue, Oct 31, 2006 at 12:38:36PM -0800, George Pavlov wrote: > Both (1::int,'a'::varchar) and (select (2::int,'a'::varchar)) are of > type record, aren't they? I don't think so. Psql gives you a hint that not: testing=# SELECT (1::int, 'a'::varchar); row --- (1,a) (1 row) testing=# S

Re: [SQL] record datatype comparisons

2006-10-31 Thread George Pavlov
thanks fo the reply. i was misled by pgAdmin (1.6) giving both as "record" in the datatype (i thought "row" and "?column?" were just "best guess" column headers). so, if they are indeed differently shaped is there any way to make them be the same shape? note that this one also fails with the sam

Re: [SQL] record datatype comparisons

2006-10-31 Thread Volkan YAZICI
On Oct 31 04:22, Andrew Sullivan wrote: > On Tue, Oct 31, 2006 at 12:38:36PM -0800, George Pavlov wrote: > > Both (1::int,'a'::varchar) and (select (2::int,'a'::varchar)) are of > > type record, aren't they? > > I don't think so. Psql gives you a hint that not: > > testing=# SELECT (1::int, 'a':

Re: [SQL] record datatype comparisons

2006-10-31 Thread Alvaro Herrera
George Pavlov wrote: > thanks fo the reply. i was misled by pgAdmin (1.6) giving both as > "record" in the datatype (i thought "row" and "?column?" were just "best > guess" column headers). > > so, if they are indeed differently shaped is there any way to make them > be the same shape? > > note

Re: [SQL] record datatype comparisons

2006-10-31 Thread Volkan YAZICI
On Oct 31 06:49, Alvaro Herrera wrote: > George Pavlov wrote: > > thanks fo the reply. i was misled by pgAdmin (1.6) giving both as > > "record" in the datatype (i thought "row" and "?column?" were just "best > > guess" column headers). > > > > so, if they are indeed differently shaped is there a

Re: [SQL] Table Relationships

2006-10-31 Thread Curtis Scheer
Thanks for the help.   From: Aaron Bono [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 31, 2006 2:44 PM To: A. Kretschmer Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Table Relationships   On 10/31/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am  Tue, dem 31.10.2006

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread roopa perumalraja
Hi Richard,   Thanks a lot. I still am not able to get the result for all the rics in the ticks table but I am able to get the result for a particular ric.   Can you help me with getting the result for all the rics in the ticks table   Thanks RoopaRichard Broersma Jr <[EMAIL PROTECTED]> wrot

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread Richard Broersma Jr
> Hi Richard, > > Thanks a lot. I still am not able to get the result for all the rics in the > ticks table but I > am able to get the result for a particular ric. > > Can you help me with getting the result for all the rics in the ticks table > > Thanks > Roopa Could you send

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread roopa perumalraja
Hi Richard,   Thanks a lot.   I am sending you the create statement of tables & few insert statements as well. Hope this helps to solve the problem.   CREATE TABLE ticks(  tick_id int8 NOT NULL DEFAULT nextval(('ticks_s'::text)::regclass),  ric varchar(30) NOT NULL,  tick_date date NOT NULL, 

Re: [HACKERS] [SQL] Case Preservation disregarding case

2006-10-31 Thread Tom Lane
"Chuck McDevitt" <[EMAIL PROTECTED]> writes: > Equivalent, yes. But I can interpret that clause it mean I can show > either the case folded or non-case-folded value in the information > schema, as they are equivalent. Well, that's an interesting bit of specs-lawyering, but I don't see how you can