Re: [SQL] Selecting "sample" data from large tables.

2004-06-03 Thread Greg Stark
> Joseph Turner <[EMAIL PROTECTED]> writes: > > I have a table with a decent number of rows (let's say for example a > > billion rows). I am trying to construct a graph that displays the > > distribution of that data. However, I don't want to read in the > > complete data set (as reading a billi

Re: [SQL] CHAR(n) always trims trailing spaces in 7.4

2004-06-03 Thread elein
Apparently the ::char is cast to varchar and then text? That explains x || ' ' || x On Tue, Feb 17, 2004 at 05:07:24PM -0700, scott.marlowe wrote: > On Tue, 17 Feb 2004, Tom Lane wrote: > > > elein <[EMAIL PROTECTED]> writes: > > > This is an example of the problem. It used to expand > > > the m

Re: [SQL] Function

2004-06-03 Thread scott.marlowe
On Mon, 16 Feb 2004, Sumita Biswas (sbiswas) wrote: > Thanks for the answer. > I have one more issue. How do I test a function that I wrote? > I was able to create a function called Proc_ConferenceSummary(). > In SQL Server I used to run it through query analyzer by writing the > following command

[SQL] need help with os x objects into a db

2004-06-03 Thread Theodore Petrosky
Does anyone here have experience with OS X and storing NSData objects in a postgresql db? I have archived data that I want to store in a bytea column. I just can not get it to work. I hope there is a kind soul that can help Ted __ Do you Yahoo!? Yahoo! Finan

Re: [SQL] Selecting "sample" data from large tables.

2004-06-03 Thread Tom Lane
Joseph Turner <[EMAIL PROTECTED]> writes: > I have a table with a decent number of rows (let's say for example a > billion rows). I am trying to construct a graph that displays the > distribution of that data. However, I don't want to read in the > complete data set (as reading a billion rows wou

Re: [SQL] Ok, what am I doing wrong here?

2004-06-03 Thread Marc G. Fournier
On Tue, 17 Feb 2004, Karl Denninger wrote: > I want to insert values from one table into another, and add some "default" > values (that are not defaults on the table different reasons - that is, this > is maintenance function and in normal operation there would be "real" values > there - and null

Re: [SQL] Reference with condition on other table column?

2004-06-03 Thread Bruno Wolff III
On Thu, Jun 03, 2004 at 12:16:43 +0300, Andrei Bintintan <[EMAIL PROTECTED]> wrote: > > How can I write a constraint on Table T1 and Table T2 that if the "num" from > T1 and "num" from T2 are referenced from table "relation" than I cannot > update the "active" field to "false". My target is that

[SQL] Selecting "sample" data from large tables.

2004-06-03 Thread Joseph Turner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have a table with a decent number of rows (let's say for example a billion rows). I am trying to construct a graph that displays the distribution of that data. However, I don't want to read in the complete data set (as reading a billion rows would

Re: [SQL] ORDER BY TIMESTAMP_column ASC, NULL first

2004-06-03 Thread Bruno Wolff III
On Thu, Feb 12, 2004 at 11:06:26 +0100, Fredrik Wendt <[EMAIL PROTECTED]> wrote: > > The query to use would be, > > SELECT ip.id FROM IPv4Address ip ORDER BY assignedAt ASC LIMIT 1; > > with the exception that this returns rows with NULL at the end, instead > of at the beginning which is

Re: [SQL] Reference with condition on other table column?

2004-06-03 Thread Stephan Szabo
On Thu, 3 Jun 2004, Andrei Bintintan wrote: > Hi to all, > > I have the following tables: > CREATE TABLE t1( > id serial PRIMARY KEY, > active boolean NOT NULL DEFAULT 'y', > num int4 NOT NULL, > ); > CREATE UNIQUE INDEX t1_uniqueidx ON t1(num) WHERE active; > > CREATE TABLE t2( > id serial PRIMAR

Re: [SQL] Date format problems

2004-06-03 Thread Richard Huxton
Mark Roberts wrote: Hi im using the function below to insert data into my db; im using now() to get the timestamptz, however when inserted in the db the format seems to vary, the majority of the time its in the required European style but does spontaniously change to various other type can anyone t

Re: [SQL] Date format problems

2004-06-03 Thread Stef
Tom Lane mentioned : => Check the manual about runtime => configuration settings and postmaster switches. I use this : export PGDATESTYLE= (=ISO,European) P.S. Is there something wrong with the date on the postgres mailing list machine? All my mail from the list arrives with a date of

[SQL] Reference with condition on other table column?

2004-06-03 Thread Andrei Bintintan
Hi to all,   I have the following tables: CREATE TABLE t1(id serial PRIMARY KEY,active boolean NOT NULL DEFAULT 'y',num int4 NOT NULL,);CREATE UNIQUE INDEX t1_uniqueidx ON t1(num) WHERE active; CREATE TABLE t2(id serial PRIMARY KEY,active boolean NOT NULL DEFAULT 'y',num int4 NOT NULL,);CR

Re: [SQL] ORDER BY TIMESTAMP_column ASC, NULL first

2004-06-03 Thread Denis
Hi Rod, Try this ace=> create table test(name text, age int ); CREATE ace=> insert into test values ('Denis',26); INSERT 1823531 1 ace=> insert into test values (null,26); INSERT 1823532 1 ace=> select * from test order by name; name | age ---+- Denis | 26 | 26 (2 rows) a

Re: [SQL] bytea or blobs?

2004-06-03 Thread Richard Huxton
beyaNet Consultancy wrote: Hi, what I am trying to do is to be able to store images in my database. What I wanted to know is this: 1. Would it be better to have the image field type as a bytea or a blob? I have heard it mentioned that bytea would be better as doing data dumps would also insure