Re: [SQL] Question about index/constraint definition in a table

2013-10-09 Thread David Johnston
David Johnston wrote > > JORGE MALDONADO wrote >> I have a table as follows: >> >> Table Artist Colaborations >> >> * car_id (integer field, primary key) >> * car_song (integer field, foreign key, for

Re: [SQL] Question about index/constraint definition in a table

2013-10-09 Thread David Johnston
JORGE MALDONADO wrote > I have a table as follows: > > Table Artist Colaborations > > * car_id (integer field, primary key) > * car_song (integer field, foreign key, foreign table is a catalog of > son

Re: [SQL] Question regarding modelling for time series

2012-09-05 Thread Sergey Konoplev
On Wed, Sep 5, 2012 at 11:39 AM, Alex Grund wrote: > Since the data is not revised further than one month behind, the whole > series ex-post would look like that: [3] > Unemployment; release: 2011/12/01; reporting: 2011/11/01; value: 1 > Unemployment; release: 2011/12/01; reporting: 2011/10/01; va

Re: [SQL] Question regarding modelling for time series

2012-09-05 Thread Alex Grund
Sergey, thank you very much for your hints, I will play a bit with that and maybe come back to the list. Just for clarification, I attached some more explanation and examples below. 2012/9/5 Sergey Konoplev : > I am not quite understand what is meant here. Could you please provide > more explana

Re: [SQL] Question regarding modelling for time series

2012-09-04 Thread Sergey Konoplev
On Wed, Sep 5, 2012 at 12:16 AM, Alex Grund wrote: > So, I thought of a relational data base model like that: It is worth to make like this TABLE 'ts' (TimeSeries) PK:id | name TABLE 'r' (Releases) PK:id | FK:ts_id | release_date | reporting_date | value It is a little more redundant but easie

Re: [SQL] Question on imports with foreign keys

2011-12-10 Thread Jasen Betts
On 2011-12-08, Andreas wrote: > Hi, > > suppose you need to import a csv with standard ciolums like name, > adress, phone, ... and some additional text columns that need to be > split off into referenced tables. ... > How is the easiest way to to find the customer.id of the new customers > so I

Re: [SQL] Question on imports with foreign keys

2011-12-09 Thread Emre Hasegeli
On Thu, 08 Dec 2011 12:10:06 +0200, Andreas wrote: Lets's say there were already 1000 records in the customers table. Now I add 357 new customers to this table. If I use one of your queries I'd get all 1357 entries of customers since "project_x.projectinfos" would be newly created for this p

Re: [SQL] Question on imports with foreign keys

2011-12-08 Thread Andreas
Am 08.12.2011 09:39, schrieb Emre Hasegeli: On Thu, 08 Dec 2011 08:48:51 +0200, Andreas wrote: How is the easiest way to to find the customer.id of the new customers so I can insert the projectinfos? It is easy to select rows not related with another table. One of the following queries ca

Re: [SQL] Question on imports with foreign keys

2011-12-08 Thread Emre Hasegeli
On Thu, 08 Dec 2011 08:48:51 +0200, Andreas wrote: Hi, suppose you need to import a csv with standard ciolums like name, adress, phone, ... and some additional text columns that need to be split off into referenced tables. Those lookup-tables will only be needed for a project with limite

Re: [SQL] question about reg. expression

2011-01-22 Thread Jasen Betts
On 2011-01-18, andrew1 wrote: > hi all, > > these return t: > select 'ab' ~ '[a-z]$' this matches the b and the end of the string > select 'ab' ~ '^[a-z]' this matches the start of the string and the a > select 'ab' ~ '^[a-z]$' returns f > Can't I use ^ and $ at the same time to match, in thi

Re: [SQL] question about reg. expression

2011-01-19 Thread Kenneth Marshall
On Wed, Jan 19, 2011 at 08:17:50AM -0500, Stephen Belcher wrote: > Another way to match multiple occurrences is to use curly brackets with a > number, like: > select 'ab' ~ '^[a-z]{2}$'; > > It can be done with a range of numbers as well: > select 'ab' ~ '^[a-z]{2,4}$'; > select 'abab' ~ '^[a-z]{2

Re: [SQL] question about reg. expression

2011-01-19 Thread Stephen Belcher
Another way to match multiple occurrences is to use curly brackets with a number, like: select 'ab' ~ '^[a-z]{2}$'; It can be done with a range of numbers as well: select 'ab' ~ '^[a-z]{2,4}$'; select 'abab' ~ '^[a-z]{2,4}$'; I believe, however, that the curly brackets notation was introduced in

Re: [SQL] question about reg. expression

2011-01-19 Thread Samuel Gendler
I'd think you need to indicate multiple alphabetic matches. Your first regex actually matches only b followed by end of string and the second is really only matching start of string followed by a. The third is looking for a single character string. Try this: select 'ab' ~ '^[a-z]+$' or this: sel

Re: [SQL] Question about PQexecParams

2010-10-01 Thread Dmitriy Igrishin
Hey Kenneth, There are three benefits: > > - reduces the CPU overhead in both the client and the DB server > for converting to/from ASCII numbers > You solution based on PL/pgSQL function. I am doubt that execution of PL/pgSQL parser (loadable module, which aren't built into the PostgreSQL server

Re: [SQL] Question about PQexecParams

2010-09-30 Thread Kenneth Marshall
On Thu, Sep 30, 2010 at 10:30:16PM +0400, Dmitriy Igrishin wrote: > Hey Kenneth, > > Thank you for solution. But sorry, personally, I don't clearly > understand the benefits of this code compared with using > simple array literals or even array constructors... > Conversion "overheads" from text? D

Re: [SQL] Question about PQexecParams

2010-09-30 Thread Dmitriy Igrishin
Hey Kenneth, Thank you for solution. But sorry, personally, I don't clearly understand the benefits of this code compared with using simple array literals or even array constructors... Conversion "overheads" from text? Doubtfully... -- // Dmitriy.

Re: [SQL] Question about PQexecParams

2010-09-30 Thread Kenneth Marshall
quot; option to keep the alignment from being padded in the structure to 8 bytes, which messed up the binary encoding of the array. Please let me know if you have any questions. Regards, Ken On Wed, Sep 22, 2010 at 12:07:15PM +0200, Steve wrote: > > Original-Nachricht >

Re: [SQL] Question Regarding Unique Index on Table

2010-09-23 Thread Kenneth Marshall
9.0 allows you to defer unique constraints. Ken On Thu, Sep 23, 2010 at 10:18:39AM -0700, Ozer, Pam wrote: > Is it possible to disable a unique index? I have a process that's > running that inserts duplicate records into a table and then does a > cleanup afterwards. I know that I can drop the i

Re: [SQL] Question about PQexecParams

2010-09-22 Thread Steve
Original-Nachricht > Datum: Sun, 12 Sep 2010 01:52:04 +0400 > Von: Dmitriy Igrishin > An: Steve > CC: pgsql-sql@postgresql.org > Betreff: Re: [SQL] Question about PQexecParams > Hey Steve, > > 2010/9/11 Steve > > > Hello list, > > &

Re: [SQL] Question regarding indices

2010-09-14 Thread Frank Bax
Steve wrote: Original-Nachricht Datum: Sat, 11 Sep 2010 11:08:00 -0400 Von: Lew An: pgsql-sql@postgresql.org Betreff: Re: [SQL] Question regarding indices On 09/11/2010 08:29 AM, Steve wrote: I have a small question about the order of values in a query. Assume I have a

Re: [SQL] Question regarding indices

2010-09-12 Thread Steve
Original-Nachricht > Datum: Sat, 11 Sep 2010 11:08:00 -0400 > Von: Lew > An: pgsql-sql@postgresql.org > Betreff: Re: [SQL] Question regarding indices > On 09/11/2010 08:29 AM, Steve wrote: > > I have a small question about the order of values in a query

Re: [SQL] Question regarding indices

2010-09-12 Thread Lew
On 09/11/2010 08:29 AM, Steve wrote: I have a small question about the order of values in a query. Assume I have a table with the following fields: uid INT, data BIGINT, hits INT And an unique index on (uid, data). I use libpq C API to query data from the table. The query is something li

Re: [SQL] Question about PQexecParams

2010-09-11 Thread Dmitriy Igrishin
Hey Steve, 2010/9/11 Steve > Hello list, > > I would like to call a function from my C application by using libpq and > PQexecParams. My problem is that I don't know how to specify that I want to > send an array to the function. > > Assume the function is called lookup_data and takes the followi

Re: [SQL] Question regarding indices

2010-09-11 Thread Tom Lane
"Steve" writes: >> Von: Tom Lane >> It's unlikely to make enough difference to be worth the trouble. >> > Making a quick sort is ultra easy in C. Anyway... is there a > difference in the speed of the query with pre-sorted values or not? > If there is one then I will go and sort the values. I di

Re: [SQL] Question regarding indices

2010-09-11 Thread Steve
Original-Nachricht > Datum: Sat, 11 Sep 2010 11:04:16 -0400 > Von: Tom Lane > An: "Steve" > CC: pgsql-sql@postgresql.org > Betreff: Re: [SQL] Question regarding indices > "Steve" writes: > > I have a small question about the o

Re: [SQL] Question regarding indices

2010-09-11 Thread Steve
Original-Nachricht > Datum: Sat, 11 Sep 2010 10:05:18 -0400 > Von: Michael Gould > An: Steve > Betreff: Re: [SQL] Question regarding indices > Steve, > Hello Michael, > If I remember correctly the sort only works on the final result set and so >

Re: [SQL] Question regarding indices

2010-09-11 Thread Tom Lane
"Steve" writes: > I have a small question about the order of values in a query. Assume I have a > table with the following fields: > uid INT, > data BIGINT, > hits INT > And an unique index on (uid, data). I use libpq C API to query data from the > table. The query is something like this:

Re: [SQL] Question about POSIX Regular Expressions performance on large dataset.

2010-08-17 Thread Sergey Konoplev
On 18 August 2010 06:30, Jose Ildefonso Camargo Tolosa wrote: > Hi, again, > > I just had this wacky idea, and wanted to share it: > > what do you think of having the dataset divided among several servers, > and sending the query to all of them, and then just have the > application "unify" the res

Re: [SQL] Question about POSIX Regular Expressions performance on large dataset.

2010-08-17 Thread Scott Marlowe
You can do something similar on the same machine if you can come up with a common way to partition your data. Then you split your 1B rows up into chunks of 10M or so and put each on a table and hit the right table. You can use partitioning / table inheritance if you want to, or just know the tabl

Re: [SQL] Question about POSIX Regular Expressions performance on large dataset.

2010-08-17 Thread Jose Ildefonso Camargo Tolosa
Hi, again, I just had this wacky idea, and wanted to share it: what do you think of having the dataset divided among several servers, and sending the query to all of them, and then just have the application "unify" the results from all the servers? Would that work for this kind of *one table* se

Re: [SQL] Question about POSIX Regular Expressions performance on large dataset.

2010-08-17 Thread Scott Marlowe
On Tue, Aug 17, 2010 at 8:21 PM, Jose Ildefonso Camargo Tolosa wrote: > Hi! > > I'm analyzing the possibility of using PostgreSQL to store a huge > amount of data (around 1000M records, or so), and these, even > though are short (each record just have a timestamp, and a string that > is less t

Re: [SQL] Question on COUNT performance

2010-07-15 Thread REISS Thomas DSIC BIP
emove them and keep the query. So the function becomes a simple SQL function. Hope this helps :-) Regards Jean-Michel Souchard and Thomas Reiss Message original Sujet : Re: [SQL] Question on COUNT performance De : Anders Østergaard Jensen Pour : pgsql-sql@postgresql.org Date

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Lee Hachadoorian
It appears that the acl functions use more SELECTs than necessary. For f_customer_acl(uid integer, cid integer), I might use: PERFORM 1 FROM customers JOIN users USING (org_id) WHERE customer_id = cid and user_id = uid; RETURN FOUND; This still requires one call to f_customer_acl() (and there

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Anders Østergaard Jensen
Hi all, Thank you so much for your kind replies. It has all been a great help. I tried the SELECT COUNT(1) but that didn't yield any improvement, sorry. Doing the index on f_plan_event_acl( ... ) wont work, as the parameters are frequently shifted (the second parameter denotes the id of a user i

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Anders Østergaard Jensen
Hi all, Thank you so much for your kind replies. It has all been a great help. I tried the SELECT COUNT(1) but that didn't yield any improvement, sorry. Doing the index on f_plan_event_acl( ... ) wont work, as the parameters are frequently shifted (the second parameter denotes the id of a user i

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Lee Hachadoorian
In retrospect, it's a big assumption whether f_project_acl() or f_customer_acl() always return TRUE. If they can return FALSE, you probably want to replace the statements inside the FOR..LOOP with >IF plan_record.project_id IS NOT NULL THEN >IF f_project_ac

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Lee Hachadoorian
The first statement of the function > : select into user * > from users where id = uid; appears to be a useless drag, as I don't see the user record referred to anywhere else in the function. There appears to be other unnecessary statements. For

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Reinoud van Leeuwen
On Wed, Jul 14, 2010 at 07:30:39AM -0600, Joshua Tolley wrote: > > Have you tried 'select count (1)..."? > > If this helps at all, it's unlikely to help much. I remember having seen > discussion somewhere that there's an optimization such that count(*) and > count(1) do the same thing anyway, but

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Joshua Tolley
On Wed, Jul 14, 2010 at 02:30:29PM +0200, Reinoud van Leeuwen wrote: > On Wed, Jul 14, 2010 at 09:58:10PM +1000, Anders ??stergaard Jensen wrote: > > SELECT count(*) AS count_all FROM "plan_events" WHERE (f_plan_event_acl(17, > > plan_events.id)) > > > >

Re: [SQL] Question on COUNT performance

2010-07-14 Thread Reinoud van Leeuwen
On Wed, Jul 14, 2010 at 09:58:10PM +1000, Anders ??stergaard Jensen wrote: > Hello mailing list, > > I have a performance problem with my postgres 8.4.4 database. The query is > the following: > > SELECT count(*) AS count_all FROM "plan_events" WHERE (f_plan_event_acl(17, > plan_events.id)) > >

Re: [SQL] Question about domains.

2010-07-08 Thread Vibhor Kumar
On 08/07/10 2:27 PM, Dmitriy Igrishin wrote: Hey all, Is there a way to add constraint to the domain that used by a composite type that used by a table? E.g.: Currently in PG, adding constraint on Domain, which is already in use is not supported. CREATE DOMAIN superid AS integer; CREATE T

Re: [SQL] question about partitioning

2010-06-24 Thread Petru Ghita
There is no partitioning by size that I know of but at: http://www.postgresql.org/docs/8.4/interactive/ddl-partitioning.html there is very good documentation on the topic. As of this last weekend I had myself to do some testing with partitioning in Postgres 8.4. I had 7000 items. For each of them

Re: [SQL] question about partitioning

2010-06-24 Thread Joshua Gooding
Doug -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Joshua Gooding Sent: Thursday, June 24, 2010 2:31 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] question about partitioning I think I replied to the individual and not

Re: [SQL] question about partitioning

2010-06-24 Thread Little, Douglas
esql.org Subject: Re: [SQL] question about partitioning I think I replied to the individual and not to the list before As of right now size doesn't matter, I need to partition it via a date. 10 partitions, 10 weeks worth of data. I was thinking of partitioning it off every 32GB of data,

Re: [SQL] question about partitioning

2010-06-24 Thread Joshua Gooding
I think I replied to the individual and not to the list before As of right now size doesn't matter, I need to partition it via a date. 10 partitions, 10 weeks worth of data. I was thinking of partitioning it off every 32GB of data, but that is not exactly what I am looking to do. Joshu

Re: [SQL] question about partitioning

2010-06-24 Thread Jasen Betts
On 2010-06-24, Joshua Gooding wrote: > Right now I am in the process of migrating an Oracle DB over to Postgres > 8.4.3. The table is partitioned by size. Is there anyway to partition > the new postgres table by size? I created some partitions for the new > table, but I didn't give postgres

Re: [SQL] Question about slow queries...

2010-05-27 Thread A. Kretschmer
In response to Good, Thomas : > > Hi, > > I have a question about a query that starts out fine and over time > slows to a halt - but only on a webhosted site. Locally it does fine. > > The query is a singleton select (no joins), hitting a table with about > 5,000 records in it. Over time the q

Re: [SQL] Question about slow queries...

2010-05-27 Thread Tom Lane
"Good, Thomas" writes: > I have a question about a query that starts out fine and over time slows to a > halt - but only on a webhosted site. Locally it does fine. > The query is a singleton select (no joins), hitting a table with about > 5,000 records in it. Over time the query slows to a craw

Re: [SQL] question about timestamp with tz

2009-10-22 Thread Scott Marlowe
On Thu, Oct 22, 2009 at 2:41 PM, the6campbells wrote: > Question.. is there a way that I can get Postgres to return the tz as > supplied on the insert statement PostgreSQL converts the timezone to GMT and stores it with no offset, then adds an offset based on the TZ of the client requesting it ba

Re: [SQL] question about timestamp with tz

2009-10-22 Thread Tom Lane
the6campbells writes: > Question.. is there a way that I can get Postgres to return the tz as > supplied on the insert statement No. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgres

Re: [SQL] Question

2009-09-03 Thread A. Kretschmer
In response to aymen marouani : > Hi for all, > What is the possible sources of the SQLState 55000 "OBJECT NOT IN PREREQUISITE > STATE" ? > The error 55000 was triggered when I executed the following query : > "select currval('"BatchTreatment_batch_treatment_id_seq"');" Within this session, first

Re: [SQL] Question

2009-09-02 Thread Ross J. Reedstrom
On Wed, Sep 02, 2009 at 04:28:34PM +0200, aymen marouani wrote: > Hi for all, > What is the possible sources of the SQLState 55000 "OBJECT NOT IN > PREREQUISITE STATE" ? > The error 55000 was triggered when I executed the following query : > "select currval('"BatchTreatment_batch_treatment_id_seq"'

Re: [SQL] Question

2009-09-02 Thread Rob Sargent
Call nextval first? Too many quotes? aymen marouani wrote: Hi for all, What is the possible sources of the SQLState 55000 "OBJECT NOT IN PREREQUISITE STATE" ? The error 55000 was triggered when I executed the following query : "select currval('"BatchTreatment_batch_treatment_id_seq"');" Tha

Re: [SQL] Question about encoding

2009-08-25 Thread Denis BUCHER
Hello, Peter Eisentraut a écrit : >> Question 1 : >> Is it the expected behavior ? These characters have a SQL_ASCII >> equivalent because I already have them stored in another table of the >> same database > > SQL_ASCII is not the same as ASCII. SQL_ASCII means, take the bytes as > they come.

Re: [SQL] Question about encoding

2009-08-24 Thread Peter Eisentraut
On mån, 2009-08-24 at 18:42 +0200, Denis BUCHER wrote: > Question 1 : > Is it the expected behavior ? These characters have a SQL_ASCII > equivalent because I already have them stored in another table of the > same database SQL_ASCII is not the same as ASCII. SQL_ASCII means, take the bytes as th

Re: [SQL] Question on Escape-string

2009-01-03 Thread Steve Midgley
At 05:20 AM 1/1/2009, pgsql-sql-ow...@postgresql.org wrote: To: pgsql-sql@postgresql.org Subject: Question on Escape-string X-Archive-Number: 200812/132 X-Sequence-Number: 32082 Dear all, I am using pl/pgsql to develop a function to implement some logic to load BLOB data, like .tif file, to po

Re: [SQL] Question on partitioning

2008-08-22 Thread s . caillet
Hi Christina, Quoting Oliveiros Cristina <[EMAIL PROTECTED]>: > Hello , All. > > I am not sure if this is the right mailing list to place this question. > If it doesn't, please kindly redirect me to the right list. > > I have a giant table with about 10,6 million records. > > Queries on it are us

Re: [SQL] Question on partitioning

2008-08-21 Thread Mark Roberts
On Thu, 2008-08-21 at 15:25 +0100, Oliveiros Cristina wrote: > Hello , All. > > I am not sure if this is the right mailing list to place this > question. > If it doesn't, please kindly redirect me to the right list. > > I have a giant table with about 10,6 million records. > > Queries on it

Re: [SQL] Question on partitioning

2008-08-21 Thread Scott Marlowe
On Thu, Aug 21, 2008 at 8:25 AM, Oliveiros Cristina <[EMAIL PROTECTED]> wrote: > Hello , All. > > I am not sure if this is the right mailing list to place this question. > If it doesn't, please kindly redirect me to the right list. > > I have a giant table with about 10,6 million records. 10.6 mil

Re: [SQL] Question 2 Interval and timestamptz

2008-03-26 Thread Shawn
Awesome Adrian! Thanks! Just what I needed. On Wednesday 26 March 2008 16:24:34 you wrote: > -- Original message -- > From: Shawn <[EMAIL PROTECTED]> > > > Hello! > > > > The second part of my question is: > > > > Given a value as an interval, see previous p

FW: Re: [SQL] Question 2 Interval and timestamptz

2008-03-26 Thread Adrian Klaver
-- Forwarded Message: -- From: [EMAIL PROTECTED] (Adrian Klaver) To: Shawn <[EMAIL PROTECTED]> Subject: Re: [SQL] Question 2 Interval and timestamptz Date: Wed, 26 Mar 2008 16:24:39 + > > -- Original message -- > From

Re: [SQL] Question on interval

2007-04-20 Thread Steve Crawford
Rodrigo De León wrote: > On 4/20/07, Wei Weng <[EMAIL PROTECTED]> wrote: >> Hi all. >> >> How do I write a query that converts an interger to the interval type? >> >> Like convert integer 10 to INTERVAL '10 seconds'? >> >> The integer is a column in a table though, so it is more like convert >> int

Re: [SQL] Question on interval

2007-04-20 Thread Scott Marlowe
On Fri, 2007-04-20 at 13:53, Wei Weng wrote: > Hi all. > > How do I write a query that converts an interger to the interval type? > > Like convert integer 10 to INTERVAL '10 seconds'? > > The integer is a column in a table though, so it is more like convert > integer tbl.theInteger to INTERVAL

Re: [SQL] Question on interval

2007-04-20 Thread Michael Glaesemann
On Apr 20, 2007, at 13:53 , Wei Weng wrote: How do I write a query that converts an interger to the interval type? Like convert integer 10 to INTERVAL '10 seconds'? An easy way to do this is: SELECT 10 * INTERVAL '1 second'; The integer is a column in a table though, so it is more like

Re: [SQL] Question on interval

2007-04-20 Thread Rodrigo De León
On 4/20/07, Wei Weng <[EMAIL PROTECTED]> wrote: Hi all. How do I write a query that converts an interger to the interval type? Like convert integer 10 to INTERVAL '10 seconds'? The integer is a column in a table though, so it is more like convert integer tbl.theInteger to INTERVAL 'tbl.theInte

Re: [SQL] question on plpgsql block

2007-04-12 Thread A. Kretschmer
am Thu, dem 12.04.2007, um 15:44:19 -0700 mailte Karthikeyan Sundaram folgendes: > Hi Gurus, > > I tried a plpgsql block from the php. > > example > > a='begin > insert into table a values (); > insert into table b values () > insert into table c values

Re: [SQL] Question about undefinably query...

2007-04-10 Thread Tom Lane
"A. Kretschmer" <[EMAIL PROTECTED]> writes: > there was a question on #postgresql (irc-channel) from CyberDuck without > an answer. A little example: Multiple SRFs in a targetlist behave, um, strangely. I think the rule is that all are cycled until they all chance to report "done" at the same tim

Re: [SQL] Question on pgpsql function

2007-04-08 Thread Adrian Klaver
On Sunday 08 April 2007 12:47 pm, Karthikeyan Sundaram wrote: > Hi Everybody, > >I am using Postgres 8.1.0 and I have a requirement. > > I have a table > > create table weekly_tbl (id int, week_flag bit(7) not null default > '111'); > > I want to create a function like this > > create fu

Re: [SQL] question on passing parameter in sql query

2007-02-07 Thread Chad Wagner
On 2/7/07, Karthikeyan Sundaram <[EMAIL PROTECTED]> wrote: I don't want to compare with Oracle and postgres. But I have a situation. I am using psql command line tool supplied by postgres. In Oracle I can say select * from emp where emp_id = &1 Oracle will ask: Enter a value

Re: [SQL] Question regarding multibyte.

2007-02-04 Thread Karthikeyan Sundaram
Hi, I am new to postgres. I asked a question regarding multibyte display. I got only one response. Hence, I am re-iterating the question again to a larger audience. We are using 8.2 release of postgres. Recently we converted our database to multibyte on our dev machine. we want to test t

Re: [SQL] Question about GUI

2007-01-10 Thread Devrim GUNDUZ
Hş, On Tue, 2007-01-09 at 17:45 -0600, Judith wrote: > I just want to know if there is some GUI with postgreSQL for Fedore Core 3?? There is pgadmin 1.2.0 (old release, but it works) for Fedora Core 3: http://www.postgresql.org/ftp/pgadmin3/release/v1.2.0/fc3/ Recent versions of pgadmin3 won't

Re: [SQL] Question about GUI

2007-01-09 Thread Phillip Smith
Assuming you mean for administration, a couple of the options available out there are pgAdmin and phpPgAdmin... pgAdmin is a stand-alone program, available for both *nix and Windows, while phpPgAdmin is a web-based admin console. Another option is the PostgreSQL module of WebMin http://www.pgadmi

Re: [SQL] Question about "AT TIME ZONE"

2006-12-05 Thread Tom Lane
"Collin Peters" <[EMAIL PROTECTED]> writes: > In the first example it says it is converted to PST "for display". In > the second example it is not converted to PST for display. Does this > mean that if a timestamp *with* a timezone is specified, and it also > includes "AT TIME ZONE", that it is n

Re: [SQL] Question about time

2006-11-16 Thread Hector Villarreal
, November 16, 2006 2:24 PM To: Judith Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Question about time On Thu, 2006-11-16 at 10:14 -0600, Judith wrote: > Hi everyone I'm doing a query like this: > > SELECT CAST(fecha_hora_factura as time) FROM nota_venta > >

Re: [SQL] Question about time

2006-11-16 Thread Joe
On Thu, 2006-11-16 at 10:14 -0600, Judith wrote: > Hi everyone I'm doing a query like this: > > SELECT CAST(fecha_hora_factura as time) FROM nota_venta > > and I get: > > 14:16:52.824395 > > the field is timestamp type... I just want the HOUR:MINUTE:SECOND > > the q

Re: [SQL] Question about time

2006-11-16 Thread Phillip Smith
Try the to_char() function instead of cast() SELECT to_char(fecha_hora_factura, 'HH:MM:SS') FROM nota_venta Cheers, -p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judith Sent: Friday, 17 November 2006 5:14 AM To: pgsql-sql@postgresql.org Subject: [SQ

Re: [SQL] Question on UNION

2006-05-22 Thread Markus Schaber
Hi, Mark, [EMAIL PROTECTED] schrieb: > I ran into something I wasn't expecting while developing a new > application. I have two similar tables that are occasionally unioned > pulling only about 3 fields from each. During my testing phase I > noticed that the union statement was returning what a

Re: [SQL] Question about SQL Control Structure(if then, for loop)

2006-05-18 Thread Michael Artz
SELECT 'test' FROM SELECT 'test' FROM generate_series(1,10);Sorry, thought faster than I could type :)-Mike

Re: [SQL] Question about SQL Control Structure(if then, for loop)

2006-05-18 Thread Michael Artz
If you're control is that simple, you can write similar statements in pure SQL: RDM=# for i in 1 .. 10 loopRDM-# select "test"RDM-# end loop;ERROR:  syntax error at or near "for" at character 1LINE 1: for i in 1 .. 10 loop SELECT 'test' FROM RDM=# if exits ( select * from testtable)RDM-# thenRDM-#

Re: [SQL] Question about SQL Control Structure(if then, for loop)

2006-05-17 Thread A. Kretschmer
am 16.05.2006, um 21:51:45 -0400 mailte Jay Chiu folgendes: > Can someone tell me how to use if/for in psql? The document In plain SQL isn't if, then, else and so on. > shows the control structures in the PL/pgSQL section. Must I use > if/for inside some procedure/function? Yes. HTH, Andreas

Re: [SQL] Question about One to Many relationships

2006-03-27 Thread Jim C. Nasby
On Fri, Mar 24, 2006 at 06:29:25PM +0100, PFC wrote: > > > >>And I want to link the band to the album, but, if the album is a > >>compilation it'll be linked to multiple band.ids, so i can't just add > >>a column like: > > For a compilation, you should link a band to a track, not an album.

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Joe
Todd Kennedy wrote: They haven't responded me as of yet. There should be a band associated with each album -- this is handled in code, but other than that this is the only relational db way I can think of to do it. But if a band can have songs in many albums and an album can have songs from mu

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread D'Arcy J.M. Cain
On Fri, 24 Mar 2006 13:34:34 -0500 Joe <[EMAIL PROTECTED]> wrote: > Todd Kennedy wrote: > > They haven't responded me as of yet. There should be a band associated > > with each album -- this is handled in code, but other than that this > > is the only relational db way I can think of to do it. > >

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Todd Kennedy
We're not concerned with the track info. This is a listing of album information, hence the one to many relationship between the album and the artist. and for the record, i should correct myself. he said it was "bad" not "wrong". but i hadn't given him all the details. But. Yes. Thank you all

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Todd Kennedy
They haven't responded me as of yet. There should be a band associated with each album -- this is handled in code, but other than that this is the only relational db way I can think of to do it. Thanks! Todd On 3/24/06, D'Arcy J.M. Cain wrote: > On Fri, 24 Mar 2006 11:52:31 -0500 > "Todd Kennedy

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread PFC
And I want to link the band to the album, but, if the album is a compilation it'll be linked to multiple band.ids, so i can't just add a column like: For a compilation, you should link a band to a track, not an album. This opens another can of worms... I would use the following t

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Milorad Poluga
Child table references a not-existing table: ('band' insted of 'bands') Error: ERROR: relation "band" does not exist > CREATE TABLE bands ( > CREATE TABLE bands_on_album ( - - - > band_id integer REFERENCES band (id), - - - Regards, Milorad Poluga [EMAIL PROTECTED]

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread D'Arcy J.M. Cain
On Fri, 24 Mar 2006 11:52:31 -0500 "Todd Kennedy" <[EMAIL PROTECTED]> wrote: > So I've got two tables, one for albums and one for bands, for > simplicity's sake, they look like this: > > CREATE TABLE bands ( > id serial PRIMARY KEY, > name varchar(64) NOT NULL CHECK( name <> ''), > UNIQUE(name) >

Re: [SQL] Question re: relational technique

2006-03-13 Thread Robert Paulsen
On Monday 13 March 2006 03:03, Richard Huxton wrote: > Robert Paulsen wrote: > > This still requires me to modify the overall database structure but not > > the original item table. As my reward :) I get to use any type I choose > > for each new attribute. > > The whole point of the database struct

Re: [SQL] Question re: relational technique

2006-03-13 Thread Richard Huxton
Robert Paulsen wrote: This still requires me to modify the overall database structure but not the original item table. As my reward :) I get to use any type I choose for each new attribute. The whole point of the database structure is to accurately reflect the requirements of your data. If yo

Re: [SQL] Question re: relational technique

2006-03-12 Thread Robert Paulsen
On Sunday 12 March 2006 11:29, chester c young wrote: > --- Robert Paulsen <[EMAIL PROTECTED]> wrote: > > One problem with the above is that the list of attributes is fixed. I > > am looking for a way to assign new, previously undefined, attributes > > to > > > items without changing the table stru

Re: [SQL] Question re: relational technique

2006-03-12 Thread chester c young
--- Robert Paulsen <[EMAIL PROTECTED]> wrote: > One problem with the above is that the list of attributes is fixed. I > am looking for a way to assign new, previously undefined, attributes to > items without changing the table structure. Is it ever appropriate to do > the following? > ... There a

Re: [SQL] Question about Sql SELECT and optimizer

2006-03-02 Thread Michael Fuhr
On Thu, Mar 02, 2006 at 11:19:32AM -0500, Chaz. wrote: > I am trying to understand something I have seen happen. I had a select > that looked like: > > select f(A) from A, B, C where g(A) > > Where f(A) is the select that only depends on table A; > g(A) is the where part that only depends on tabl

Re: [SQL] Question about index scan vs seq scan when using count()

2006-02-23 Thread Owen Jacobson
Kashmira Patel wrote: > I did do an EXPLAIN ANALYZE as well, it also showed a > sequential scan. The table has about 600+ rows, with around 6 of them > matching the given id. Wouldn't an index scan be faster in this case? Not necessarily. It's entirely possible, if your rows are small, that 600

Re: [SQL] Question about index scan vs seq scan when using count()

2006-02-23 Thread Kashmira Patel \(kupatel\)
Sent: Thursday, February 23, 2006 2:47 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] Question about index scan vs seq scan when using count() On Thu, Feb 23, 2006 at 02:25:34PM -0800, Kashmira Patel (kupatel) wrote: > > [Kashmira] I did do an EXPLAIN ANALYZE as well, it also sh

Re: [SQL] Question about index scan vs seq scan when using count()

2006-02-23 Thread Andrew Sullivan
On Thu, Feb 23, 2006 at 02:25:34PM -0800, Kashmira Patel (kupatel) wrote: > > [Kashmira] I did do an EXPLAIN ANALYZE as well, it also showed a > sequential scan. The table has about 600+ rows, with around 6 of them > matching the given id. Wouldn't an index scan be faster in this case? EXPLAIN AN

Re: [SQL] Question about index scan vs seq scan when using count()

2006-02-23 Thread Kashmira Patel \(kupatel\)
: [SQL] Question about index scan vs seq scan when using count() > What am I doing wrong here? I want it to use my index. For small tables the sequential scan is faster, that means less disk reads is required the whole table than to use the index. If it is a large table, the index should be u

Re: [SQL] Question about index scan vs seq scan when using count()

2006-02-23 Thread Kashmira Patel \(kupatel\)
> For example: I have a table vm_message with an index on column msgid. > Will the following do a sequential scan or an index? > > select count(*) from vm_message where msgid = 3; How much of the table is that? How many rows? EXPLAIN ANALYSE will tell you if you have the right plan (estimate

Re: [SQL] Question about index scan vs seq scan when using count()

2006-02-23 Thread Andrew Sullivan
On Thu, Feb 23, 2006 at 01:44:43PM -0800, Kashmira Patel (kupatel) wrote: > My understanding of this statement is that if I use count() without a > WHERE clause, then essentially, it is applied to the entire table and > hence requires a seq scan. > But it should not require a seq scan if I have a c

Re: [SQL] Question about check constraints

2006-01-27 Thread Kashmira Patel \(kupatel\)
PROTECTED] Sent: Friday, January 27, 2006 9:25 PM To: Kashmira Patel (kupatel) Cc: Michael Fuhr; pgsql-sql@postgresql.org Subject: Re: [SQL] Question about check constraints On Fri, 27 Jan 2006, Kashmira Patel (kupatel) wrote: > Both concerns. > 1) There are actually more than two columns wit

  1   2   >