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

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

2013-10-09 Thread JORGE MALDONADO
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 songs) * car_artist (integer field, for

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

[SQL] Question regarding modelling for time series

2012-09-04 Thread Alex Grund
Hi there, I want to use a database for storing economic time series. An economic time series can be thought of as something like this: NAME| RELEASE_DATE | REPORTING_DATE | VALUE +--++--- Unemployment US | 2011/01/01 | 2010/12/01

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

[SQL] Question on imports with foreign keys

2011-12-07 Thread Andreas
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 limited life time so I create a schema that might be called "

[SQL] Question about Escaping text when calling pgplsql functions

2011-10-25 Thread Matthias Howell
I have a situation where data in a text column contains line breaks of the form \r\n if I run a select such as select count(1) from table where wordcol = 'word1\r\nword2' I get 0. Same if I run select count(1) from table where wordcol = 'word1\nword2'. I get values if I run select count(1) from

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

[SQL] question about reg. expression

2011-01-18 Thread andrew1
hi all, these return t: select 'ab' ~ '[a-z]$' select 'ab' ~ '^[a-z]' select 'ab' ~ '^[a-z]$' returns f Can't I use ^ and $ at the same time to match, in this case? thanks. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql

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

[SQL] Question Regarding Unique Index on Table

2010-09-23 Thread Ozer, Pam
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 index and rebuild. I just didn't know if there was disable the uniqueness temporarily. thanks Pam Ozer Dat

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:

[SQL] Question about PQexecParams

2010-09-11 Thread 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 following parameters: lookup_data(integer,inte

[SQL] Question regarding indices

2010-09-11 Thread Steve
Hello List, 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: SELECT uid,data,h

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

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

2010-08-17 Thread Jose Ildefonso Camargo Tolosa
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 than 128 characters in length), the strings will be matched against POSIX Regular E

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)) > >

[SQL] Question on COUNT performance

2010-07-14 Thread Anders Østergaard Jensen
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)) QUERY PLAN --

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

[SQL] Question about domains.

2010-07-08 Thread Dmitriy Igrishin
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.: CREATE DOMAIN superid AS integer; CREATE TYPE idtype AS ( id superid ); CREATE TABLE mytab (id idtype NOT NULL); ALTER DOMAIN superid ADD CONSTRAINT superid_check CHECK (VALUE >

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

[SQL] question about partitioning

2010-06-24 Thread Joshua Gooding
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 any rules to partition by, so I have 250M tes

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

[SQL] Question about slow queries...

2010-05-27 Thread 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 query slows to a crawl and I have to dump and

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

[SQL] question about timestamp with tz

2009-10-22 Thread the6campbells
Question.. is there a way that I can get Postgres to return the tz as supplied on the insert statement insert into TTSTZ(RNUM, CTSTZ) values ( 0, null); insert into TTSTZ(RNUM, CTSTZ) values ( 1, timestamp with time zone '2000-12-31 12:00:00.0-05:00'); insert into TTSTZ(RNUM, CTSTZ) values ( 2, ti

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

[SQL] Question

2009-09-02 Thread 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"');" Thanks in advance. Cordially.

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

[SQL] Question

2009-09-02 Thread 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"');" Thanks in advance. Cordially.

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

[SQL] Question about encoding

2009-08-24 Thread Denis BUCHER
Hello, I'm sure you already replied tons of questions like this, but I don't understand something. This is the situation : * I have COPY commands from a dump, encoded as UTF8 (special characters are encoded as 2-bytes). * My file contains SET client_encoding = 'UTF8'; * But when I do psql http://

[SQL] question about pgagent

2009-08-05 Thread Jan Verheyden
Hi All, First I will explain what I try to do: I'd like to synchronize more or less two databases, in a third database. I mean, I want to book keep when an object has arrived in both databases. (In one database I am allowed to use trigger function but not in the other) 1) Postgres (maint

Re: [SQL] simple SQL question

2009-03-20 Thread Kevin Duffy
Duffy Subject: RE: [SQL] simple SQL question Hi again, You got me curious so I went into my SQL browser and got cracking: SELECT companyName, capName FROM ( SELECT companyName, MIN(capitalizationlevel.caplevelmillions) FROM companies, capitalizationlevel WHERE companymil

[SQL] simple SQL question

2009-03-20 Thread Kevin Duffy
Hello All: I would like your input on how I should approach a problem. Say I have a table of companies and one attribute is the market capitalization of these companies. I have another table (definition below) and it contains capitalization levels. For example Micro Cap, Mid Cap, and Lar

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

[SQL] Question on Escape-string

2008-12-31 Thread John Zhang
Dear all, I am using pl/pgsql to develop a function to implement some logic to load BLOB data, like .tif file, to postgres DB. The issue I am facing is the file name MUST be with double back-slash \\ in order for pgsql to process the string properly. However, when the string is Escaped in my funct

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

[SQL] Question on partitioning

2008-08-21 Thread Oliveiros Cristina
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 usually slow, and if I try to do something more elaborate like an INNER JOIN w

Re: [SQL] SQL question....

2008-05-21 Thread Karl Denninger
Steve Midgley wrote: At 12:20 PM 5/21/2008, [EMAIL PROTECTED] wrote: Date: Wed, 21 May 2008 06:39:11 -0500 From: Karl Denninger <[EMAIL PROTECTED]> To: Gurjeet Singh <[EMAIL PROTECTED]> Cc: pgsql-sql@postgresql.org Subject: Re: SQL question Message-ID: <[EMAIL PROTECTED]&g

Re: [SQL] SQL question....

2008-05-21 Thread Steve Midgley
At 12:20 PM 5/21/2008, [EMAIL PROTECTED] wrote: Date: Wed, 21 May 2008 06:39:11 -0500 From: Karl Denninger <[EMAIL PROTECTED]> To: Gurjeet Singh <[EMAIL PROTECTED]> Cc: pgsql-sql@postgresql.org Subject: Re: SQL question Message-ID: <[EMAIL PROTECTED]> > Also, if you

Re: [SQL] SQL question....

2008-05-21 Thread Karl Denninger
Gurjeet Singh wrote: On Wed, May 21, 2008 at 8:33 AM, Karl Denninger <[EMAIL PROTECTED] > wrote: Gurjeet Singh wrote: On Wed, May 21, 2008 at 4:47 AM, Karl Denninger <[EMAIL PROTECTED] > wrote: Gurjeet Singh wrote:

Re: [SQL] SQL question....

2008-05-21 Thread Gurjeet Singh
On Wed, May 21, 2008 at 8:33 AM, Karl Denninger <[EMAIL PROTECTED]> wrote: > Gurjeet Singh wrote: > > On Wed, May 21, 2008 at 4:47 AM, Karl Denninger <[EMAIL PROTECTED]> > wrote: > >> Gurjeet Singh wrote: >> >>> On Tue, May 20, 2008 at 11:44 PM, Karl Denninger <[EMAIL PROTECTED]>> [EMAIL PROTECTE

Re: [SQL] SQL question....

2008-05-20 Thread Karl Denninger
Gurjeet Singh wrote: On Wed, May 21, 2008 at 4:47 AM, Karl Denninger <[EMAIL PROTECTED] > wrote: Gurjeet Singh wrote: On Tue, May 20, 2008 at 11:44 PM, Karl Denninger <[EMAIL PROTECTED]

Re: [SQL] SQL question....

2008-05-20 Thread Gurjeet Singh
On Wed, May 21, 2008 at 4:47 AM, Karl Denninger <[EMAIL PROTECTED]> wrote: > Gurjeet Singh wrote: > >> On Tue, May 20, 2008 at 11:44 PM, Karl Denninger <[EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote: >> >> assuming the following schema: >> >>create table access (name text, address ip) >

Re: [SQL] SQL question....

2008-05-20 Thread Karl Denninger
Gurjeet Singh wrote: On Tue, May 20, 2008 at 11:44 PM, Karl Denninger <[EMAIL PROTECTED] > wrote: assuming the following schema: create table access (name text, address ip) I want to construct a SELECT statement which will return ONLY tuples cont

Re: [SQL] SQL question....

2008-05-20 Thread Gurjeet Singh
On Tue, May 20, 2008 at 11:44 PM, Karl Denninger <[EMAIL PROTECTED]> wrote: > assuming the following schema: > > create table access (name text, address ip) > > I want to construct a SELECT statement which will return ONLY tuples > containing IP and name pairs IF there is an IP that has two o

Re: [SQL] SQL question....

2008-05-20 Thread Harold A. Giménez Ch.
I think this is what you're looking for: SELECT * FROM access WHERE ip IN(SELECT ip FROM access GROUP BY ip HAVING count(*) > 1) On Tue, May 20, 2008 at 3:17 PM, Karl Denninger <[EMAIL PROTECTED]> wrote: > chester c young wrote: > > create table access (name text, address ip) > > I

Re: [SQL] SQL question....

2008-05-20 Thread Karl Denninger
chester c young wrote: create table access (name text, address ip) I want to construct a SELECT statement which will return ONLY tuples containing IP and name pairs IF there is an IP that has two or more NAMEs associated with it. many ways: select a1.* from access a1 where exists(

Re: [SQL] SQL question....

2008-05-20 Thread chester c young
> create table access (name text, address ip) > > I want to construct a SELECT statement which will return ONLY tuples > containing IP and name pairs IF there is an IP that has two or more > NAMEs associated with it. > > many ways: select a1.* from access a1 where exists( select 1 from ac

[SQL] SQL question....

2008-05-20 Thread Karl Denninger
assuming the following schema: create table access (name text, address ip) I want to construct a SELECT statement which will return ONLY tuples containing IP and name pairs IF there is an IP that has two or more NAMEs associated with it. I've not figured out how to do this; I can get a

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

[SQL] Question 2 Interval and timestamptz

2008-03-26 Thread Shawn
Hello! The second part of my question is: Given a value as an interval, see previous posting, is there a simply method to take a given timestamptz value and a given interval value and create the sum or difference of the 2 in timestamptz format? The scenario is that the afore mentioned tables,

Re: [SQL] SQL question: Highest column value of unique column pairs

2008-01-14 Thread Marc Mamin
order by date desc,name regards, Marc Mamin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Jenkins Sent: Saturday, January 12, 2008 1:10 AM To: pgsql-sql@postgresql.org Subject: [SQL] SQL question: Highest column value of unique column pai

Re: [SQL] SQL question: Highest column value of unique column pairs

2008-01-12 Thread Shane Ambler
Kevin Jenkins wrote: Thanks! How would I find the highest score in the union of the two tables? I tried this but it can't find unionTable: SELECT * FROM (select fnam1 as fname,lname1 as lname, score1 as score from myscorestable union select fnam2 as fname,lname2 as lname, score2 as score from m

Re: [SQL] SQL question: Highest column value of unique column pairs

2008-01-11 Thread Kevin Jenkins
Thanks! How would I find the highest score in the union of the two tables? I tried this but it can't find unionTable: SELECT * FROM (select fnam1 as fname,lname1 as lname, score1 as score from myscorestable union select fnam2 as fname,lname2 as lname, score2 as score from myscorestable) as union

Re: [SQL] SQL question: Highest column value of unique column pairs

2008-01-11 Thread Shane Ambler
Kevin Jenkins wrote: Hi, I have the following table which holds the result of 1 on 1 matches: FName1, LName1, Score1, FName2, LName2, Score2, Date John, Doe,85 Bill, Gates, 20 Jan 1. John, Archer, 90 John, Doe,120 Jan 5 Bob,Barker, 70 Calvin, Klien

  1   2   3   4   >