[SQL] strange corruption?

2012-12-27 Thread John Fabiani
Hi, I have the following statement in a function. UPDATE orderseq SET orderseq_number = (orderseq_number + 1) WHERE (orderseq_name='InvcNumber'); All it does is update a single record by incrementing a value (int). But it never completes. This has to be some sort of bug. Anyone ha

[SQL] how to use schema with data type

2012-06-12 Thread John Fabiani
I have tried to use a user defined data type I created within a schema. But I could not figure it out. CREATE OR REPLACE FUNCTION xchromasun._chromasun_totals(date) RETURNS SETOF xchromasun.weekly_mpr AS CREATE OR REPLACE FUNCTION xchromasun._chromasun_totals(date) RETURNS SETOF "xchromasu

Re: [SQL] using ordinal_position

2012-06-11 Thread John Fabiani
On 06/11/2012 06:53 AM, Igor Neyman wrote: -Original Message- From: John Fabiani [mailto:jo...@jfcomputer.com] Sent: Thursday, June 07, 2012 7:18 PM To: pgsql-sql@postgresql.org Subject: using ordinal_position I'm attempting to retrieve data using a select statement without kn

[SQL] using ordinal_position

2012-06-07 Thread John Fabiani
I'm attempting to retrieve data using a select statement without knowing the column names. I know the ordinal position but not the name of the column (happens to be a date::text and I have 13 fields). Below provides the name of the column in position 3: select column_name from (select column_n

[SQL] defaults in a function

2012-06-06 Thread John Fabiani
Hi, In python when I create a method/function is set a default value for a passed value if one is not provided. def foo(self, event = None): In the above function if the second value is not passed a value of None is used as the default. Is this possible with plpgsql??? Johnf -- Sent via p

Re: [SQL] syncing - between databases

2012-05-13 Thread John Fabiani
nism but also introduces some > lag time. Pick your poison. > > -steve > > On Sat, May 12, 2012 at 7:28 AM, John Fabiani wrote: > > I need to maintain a sync-ed table across several databases. For > > example I have a customer table in 5 databases. If a user of any of >

[SQL] syncing - between databases

2012-05-12 Thread John Fabiani
I need to maintain a sync-ed table across several databases. For example I have a customer table in 5 databases. If a user of any of the databases inserts a new customer I need to insert the new record into the other four databases. But question is updates and deletes. I can use a trigger an

Re: [SQL] getting the OS user name

2012-04-23 Thread John Fabiani
On Monday, April 23, 2012 04:52:25 PM Andreas Kretschmer wrote: > John Fabiani wrote: > > Hi, > > In my app it is possible to login as one name and use a different name > > to > > login to postgres. > > > > Is it possible to get the actual OS login name u

[SQL] getting the OS user name

2012-04-23 Thread John Fabiani
Hi, In my app it is possible to login as one name and use a different name to login to postgres. Is it possible to get the actual OS login name using plsql. Johnf -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mai

Re: [SQL] Can I read the data without commit

2012-03-23 Thread John Fabiani
On Friday, March 23, 2012 04:00:56 PM Rob Sargent wrote: > And I believe Jonathon confirmed that you could, with the caveat that > you must select from within the transaction. I don't see that you've > laid that out your connection stategy so ymmv. I didn't see Jonathon response? Must be a dire

Re: [SQL] Can I read the data without commit

2012-03-23 Thread John Fabiani
o long. Potential concurrency issues > etc. > > On 03/23/2012 03:40 PM, Jonathan S. Katz wrote: > > On Mar 23, 2012, at 5:33 PM, John Fabiani wrote: > >> I start a transaction. > >> Begin > >> > >> Then I insert a lot of data - let's say two hundred

[SQL] Can I read the data without commit

2012-03-23 Thread John Fabiani
Hi, I know this is a newbie question but I have never had the need to do the following. I start a transaction. Begin Then I insert a lot of data - let's say two hundred rows. Now I need to read the same data (so the user can review). If the user thinks all is right then commit. Can I read th

Re: [SQL] crosstab

2012-03-12 Thread John Fabiani
e: > Hello > > maybe this article helps > http://stackoverflow.com/questions/3002499/postgresql-crosstab-query > > there are more ways > > Regards > > Pavel Stehule > > 2012/3/12 John Fabiani : > > Hi, > > I don't know if it because I'm as

[SQL] crosstab

2012-03-12 Thread John Fabiani
Hi, I don't know if it because I'm as sick as dog or I'm just a plain idiot - most likely a little of both. Here is my table week_of date, item_number text, planned_demand integer. I have week_ofitem_number planned 2012-02-125200 2012-02-195

[SQL] crosstab maybe by case statement

2012-02-24 Thread John Fabiani
Hi Folks, I have one that I need your advise on how to construct. I have the need to create a series of dates starting from a Sunday - one week apart. (select ((date_trunc('week', '2012-02-12'::date)::date) +(i+6)) as week_date from generate_series(0,84,7) i) as foo that gives a table of sun

Re: [SQL] crosstab help

2012-02-24 Thread John Fabiani
sprüngliche Nachricht- > Von: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] > Im Auftrag von John Fabiani Gesendet: Freitag, 24. Februar 2012 09:39 > An: pgsql-sql@postgresql.org > Betreff: Re: [SQL] crosstab help > > That worked! However, I need the actual

Re: [SQL] crosstab help

2012-02-24 Thread John Fabiani
> Von: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] > Im Auftrag von John Fabiani Gesendet: Freitag, 24. Februar 2012 09:11 > An: pgsql-sql@postgresql.org > Betreff: [SQL] crosstab help > > I have a simple table > item_number week_of

[SQL] crosstab help

2012-02-24 Thread John Fabiani
I have a simple table item_number week_of planned_qoh -- -- -- 5 2012-02-05 30 5 2012-02-12 40 5 2012-02-19 50 where item_number text week_of date planned

[SQL] How can I use this subselect properly in an update?

2012-02-17 Thread John Tuliao
select substring(t1.called_number from t2.offset), t1.called_number from calls_join as t1, john_prefix as t2 where strpos(t1.called_number, t2.prefix) = '1' order by length(t2.prefix) desc limit '1' ; I'm having trouble using this as a sub-select in an UPDATE. Most of the

Re: [SQL] foreign key is it a real key

2012-02-13 Thread John Fabiani
On Monday, February 13, 2012 04:50:47 PM Andreas Kretschmer wrote: > John Fabiani wrote: > > Hi, > > I have read a few articles and I'm not sure if it's me or the authors > > but I do not believe my question was answered. > > > > If I have table that h

[SQL] foreign key is it a real key

2012-02-13 Thread John Fabiani
Hi, I have read a few articles and I'm not sure if it's me or the authors but I do not believe my question was answered. If I have table that has a PK and a FK - will the planner use the FK just same as it would use the PK? IOW's is a FK also an index used by the planner? I have a lagacy tab

[SQL] Query question

2012-01-27 Thread John Tuliao
I seem to have a problem with a specific query: The inside query seems to work on it's own: select prefix from john_prefix where strpos(jpt_test.number,john_prefix.prefix) = '1' order by char_length(john_prefix.prefix) desc limit 1 but when I exec

Re: [SQL] Query Problem... Left OuterJoin / Tagging Issue

2012-01-17 Thread John Tuliao
26 PM, David Johnston wrote: On Jan 12, 2012, at 23:31, John Tuliao <mailto:jptul...@eglobalreach.net>> wrote: Hi, I've been working on this for quite awhile now and don't seem to get the proper query. I have basically 4 tables. 1. Table john_test contains the number

[SQL] Query Problem... Left OuterJoin / Tagging Issue

2012-01-12 Thread John Tuliao
Hi, I've been working on this for quite awhile now and don't seem to get the proper query. I have basically 4 tables. 1. Table john_test contains the numbers of the calls. 2. Table john_country contains the country with prefix. 3. Table john_clients contains the clients and their sub_id's

Re: [SQL] Nested custom types: array - unable to insert [SOLVED]

2011-12-30 Thread John L. Poole
On 12/30/2011 7:31 PM, David Johnston wrote: On Dec 30, 2011, at 21:53, John Poole wrote: I am trying to create a custom data type for phone numbers where I have a primary phone number and then an array of additional phone numbers qualified by certain types. Below is a set of SQL commands

[SQL] Nested custom types: array - unable to insert

2011-12-30 Thread John Poole
an someone provide me an example of how to insert one or more records into the secondary array component of the type or provide some light on creating a custom type that would hold two fields: 1) a single type 2) an array of types (this field may be null) Thank you. John Poole ===

Re: [SQL] avoid the creating the type for setof

2011-12-30 Thread John Fabiani
On Friday, December 30, 2011 06:26:19 AM John Fabiani wrote: > Hi, > I recall somewhere I saw a simple plpgsql function that returned a table > with more than one record that did not use a defined type or a temp table ( > at least I think I did). Is it possible to create such a f

[SQL] avoid the creating the type for setof

2011-12-30 Thread John Fabiani
Hi, I recall somewhere I saw a simple plpgsql function that returned a table with more than one record that did not use a defined type or a temp table ( at least I think I did). Is it possible to create such a function that will return more than one record and not require a record type or temp

Re: [SQL] using a generated series in function

2011-12-17 Thread John Fabiani
As always I respect your insights - Adrian. I do understand what I did wrong in my first attempt at getting my statement to work. But it is either over my head or there is something missing. Where is the "from" in select now()? I have been using similar SQL statements for years. I never ques

Re: [SQL] using a generated series in function

2011-12-16 Thread John Fabiani
nerate_series(0,84,7) i ) as foo The above works! Johnf On Friday, December 16, 2011 02:46:18 AM John Fabiani wrote: > Actually what would the "from" be - this could be a newbie issue here? > Neither statement requires a "from" because neither of the statements uses

Re: [SQL] using a generated series in function

2011-12-16 Thread John Fabiani
Friday, December 16, 2011 01:30:53 AM Misa Simic wrote: > It is not totally clear to me what are u trying to do... But in second > query it seems there is missing "from" > > It is as > > SELECT week-date::date AS week-date WHERE week-date in (subquery which > h

[SQL] using a generated series in function

2011-12-15 Thread John Fabiani
Hi, I am attempting (without success) use the generated series of dates that come from: select (cast(date_trunc('week', '2011-11-20'::date ) as date) + (i+6)) as week_date from generate_series(0,84,7) i in a function. select function_name(integer, date); -- function returns a numeric This do

Re: [SQL] updating a sequence

2011-11-16 Thread John Fabiani
On Tuesday, November 15, 2011 08:06:30 am John Fabiani wrote: > Hi, > I have need of a statement that updates the sequence but uses a max() to > find the number. > > alter sequence somename restart with (select max(pk) from sometable). > > I need this for automating

Re: [SQL] updating a sequence

2011-11-16 Thread John Fabiani
On Tuesday, November 15, 2011 07:46:19 pm Scott Marlowe wrote: > On Tue, Nov 15, 2011 at 5:33 PM, Samuel Gendler > > wrote: > > On Tue, Nov 15, 2011 at 4:28 PM, John Fabiani wrote: > >> On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote: > >>

Re: [SQL] updating a sequence

2011-11-15 Thread John Fabiani
On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote: > On Tue, Nov 15, 2011 at 8:06 AM, John Fabiani wrote: > > alter sequence somename restart with (select max(pk) from sometable). > > > > I need this for automating an ETL (using pentaho). > > http://

[SQL] updating a sequence

2011-11-15 Thread John Fabiani
Hi, I have need of a statement that updates the sequence but uses a max() to find the number. alter sequence somename restart with (select max(pk) from sometable). I need this for automating an ETL (using pentaho). Postgres 8.4 Thanks in advance, Johnf -- Sent via pgsql-sql mailing list (pgs

Re: [SQL] the use of $$string$$

2011-11-05 Thread John Fabiani
On Friday, November 04, 2011 11:06:37 am Richard Huxton wrote: > On 04/11/11 15:26, John Fabiani wrote: > > On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: > >> Hi, > >> I just discovered that I can use $$string$$ to account for the problem > >>

Re: [SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
On Friday, November 04, 2011 09:05:19 am David Johnston wrote: > On Nov 4, 2011, at 11:26, John Fabiani wrote: > > On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: > >> Hi, > >> I just discovered that I can use $$string$$ to account for the problem > >

Re: [SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: > Hi, > I just discovered that I can use $$string$$ to account for the problem of > single quotes in the string (or other strange char's). However, I noticed > that the table field contained E'string'. I act

[SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the table field contained E'string'. I actually tried to find info on this but I did not find anything. Could someone explain what it

Re: [SQL] using the aggregate function max()

2011-09-22 Thread John Fabiani
On Thursday, September 22, 2011 08:14:58 pm David Johnston wrote: > On Sep 22, 2011, at 22:49, John Fabiani wrote: > > Hi, > > I need a little help understanding how to attack this problem. > > > > I need to find the max(date) of a field but I need that value later in

[SQL] using the aggregate function max()

2011-09-22 Thread John Fabiani
Hi, I need a little help understanding how to attack this problem. I need to find the max(date) of a field but I need that value later in my query. If I select max(x.date_field) as special_date from (select date_field) from table where ...)x I get one row and column. But now I want to use

Re: [SQL] interesting sequence

2011-07-05 Thread John Fabiani
On Tuesday, July 05, 2011 01:11:11 pm Kevin Crain wrote: > You don't need a loop there. Assuming your order id field is of type > varchar you can just build the first part of your string and then do a > count to get the last part using a LIKE comparison: > > select count(id_order) + 1 from somet

[SQL] interesting sequence

2011-07-05 Thread John Fabiani
Hi, I have a special need to create a sequence like function. "O-20110704 -2" which is "O" for order (there are other types) "20110704" is for July 4, 2011 '2' the second order of the day for July 4, 2011 I of course can get the type and date. What I don't know is how to get is the last numb

Re: [SQL] Union out performs the single statement

2011-06-23 Thread John Fabiani
On Thursday, June 23, 2011 08:44:49 am John Fabiani wrote: > Hi, > I have a SELECT statement that is using the regexp_split_to_table function > as follows: > > ... and fk_topic in (select regexp_split_to_table(eligible_topics, > ',')::int from escourse) > > N

[SQL] Union out performs the single statement

2011-06-23 Thread John Fabiani
Hi, I have a SELECT statement that is using the regexp_split_to_table function as follows: ... and fk_topic in (select regexp_split_to_table(eligible_topics, ',')::int from escourse) Normally there are 1 to 3 values in eligible_topics as 46,50,43. The problem is the performance is terrible an

Re: [SQL] Dates and NULL's`

2011-05-10 Thread John Fabiani
On Tuesday, May 10, 2011 10:30:58 am Richard Broersma wrote: > On Tue, May 10, 2011 at 10:24 AM, John Fabiani wrote: > >> spi=> SELECT NULL::DATE >= '2011-04-01'::DATE AND NULL::DATE <= > >> '2011-04-30'::DATE; > >> ?column? > &

Re: [SQL] Dates and NULL's`

2011-05-10 Thread John Fabiani
On Tuesday, May 10, 2011 10:16:21 am Richard Broersma wrote: > On Tue, May 10, 2011 at 9:48 AM, John Fabiani wrote: > > Where mydate >= "2011/04/01"::date and mydate<= "2011/04/30"::date > > With the above where will the NULL's be selected > &

[SQL] Dates and NULL's`

2011-05-10 Thread John Fabiani
Hi, Maybe this is a dumb question but if I have a date field that contains a NULL will it show up when I ask for a where date range for the same date field. Where mydate >= "2011/04/01"::date and mydate<= "2011/04/30"::date With the above where will the NULL's be selected I ask because I wa

Re: [SQL] is there a refactor

2011-04-05 Thread John Fabiani
On Tuesday, April 05, 2011 07:44:51 am Adrian Klaver wrote: > On Tuesday, April 05, 2011 7:27:24 am John Fabiani wrote: > > Hi, > > I would like to have a simple way to retrieve information for a field > > name. By that I mean have some SQL select that will return all the &g

[SQL] is there a refactor

2011-04-05 Thread John Fabiani
Hi, I would like to have a simple way to retrieve information for a field name. By that I mean have some SQL select that will return all the tables a field name exist within a database. I did not find anything with google but of course google depends on the search string. Thanks in advance, J

Re: [SQL] Bizarreness at A2 Hosting

2011-03-17 Thread John DeSoi
tly the problem is - I am waiting for a > supervisor to call me back and I'd like to lead him to the answer so he can > fix the problem. I think you are right -- they likely have some one's stuff in the template database. On your account that does not have the problem -- is i

[SQL] quotes etc

2011-02-22 Thread John Fabiani
Hi, I would have thought that there would be a simple built-in function that would escape the quotes as ('D' Andes') to ('D\' Andes'). But I did not see anything? I am I wrong? Johnf -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://w

Re: [SQL] something simple but I can't

2011-01-29 Thread John Fabiani
On Friday, January 28, 2011 07:46:37 pm Jasen Betts wrote: > On 2011-01-29, John Fabiani wrote: > > Hi guys, > > I trying to return a 0.00 from a function it there are no records found > > else return the amount. > > > > select sum(aropen_paid) into

[SQL] something simple but I can't

2011-01-28 Thread John Fabiani
Hi guys, I trying to return a 0.00 from a function it there are no records found else return the amount. create or replace function danmeans_getpayments(text) returns numeric as $BODY$ declare invoice_num ALIAS FOR $1; _paidamt numeric; BEGIN select sum(aropen_paid) into _paidamt FROM pub

Re: [SQL] OT - load a shp file

2010-12-01 Thread John Fabiani
On Wednesday, December 01, 2010 01:13:52 am Lee Hachadoorian wrote: > John, > > Would probably be useful to see the results of the command, but a couple > of things are immediately obvious. > > First, Postgres requires identifiers to start with a letter or > underscore.

[SQL] OT - load a shp file

2010-11-30 Thread John Fabiani
Hi, How do I load a Census shp file into an exist database? I believe I have postGIS install and now I want to load the US counties shp file. the following does not appear to work shp2pgsql -s 4269 -I -W latin1 tl_2008_us_county.shp 2008_us_county | psql Plus I don't know what it does! Johnf

Re: [SQL] insert from a select

2010-11-25 Thread John Fabiani
gt; > Select cl.pkid, cl.depart, cl.sessionid, cl.instrid, > > cl.classseq,(select facility from esloc where esloc.pkid = cl.locationid) > > as > > facility, cl.schedule from esclass cl where cl.pkid in (14507,14508) > > > > 2010/11/24 John Fabiani > > > >

[SQL] insert from a select

2010-11-24 Thread John Fabiani
Hi, I have a strange issue that is mostly likely me not understanding something. I always thought that an insert statement would accept any select statement. I'm guessing I am wrong. I have created a temporary table ("tempclass") that is exact match to an existing table ('esclass'). When I

Re: [SQL] obtaining difference between minimum value and next in size

2010-11-17 Thread John Lister
groups. John - Original Message - From: Oliveiros d'Azevedo Cristina To: John Lister ; pgsql-sql@postgresql.org Sent: Wednesday, November 17, 2010 4:09 PM Subject: Re: [SQL] obtaining difference between minimum value and next in size Hi, John. I am not familiar wit

[SQL] obtaining difference between minimum value and next in size

2010-11-17 Thread John Lister
then I would like the following returned product_id, difference 2, .04 (10.05-10.01) 3, 1.97 (11.42-9.45) ,etc Any ideas? Thanks John -- Got needs? Get Goblin'! - http://www.pricegoblin.co.uk/

Re: [SQL] a general ? on select performance

2010-08-28 Thread John Fabiani
On Saturday, August 28, 2010 08:35:07 am Tom Lane wrote: > John Fabiani writes: > > I have program that loops though several thousands of records. The loop > > contains a select statement that confirms that I don't have a dup and > > then inserts a record into a d

[SQL] a general ? on select performance

2010-08-28 Thread John Fabiani
Hi, In general what are the causes of SQL select statement slow downs - other than the size of the data? I realize this is a broad question but read on please. Here's where I'm coming from: I have program that loops though several thousands of records. The loop contains a select statement tha

[SQL] need to debug

2010-08-16 Thread John Fabiani
Could someone provide a link or help me understand what is required to get function debugging working. I haven't started yet and I thought it best to check with you guys before I start. Just the little I have researched has me worried and I do not want to mess up my current install. I'm on op

Re: [SQL] What does PostgreSQL do when time goes backward?

2010-08-04 Thread John Hasler
than you might expect from a clock > conditioned with ntpd. Is it a VM or is there something going on that > would stop or suspend your system? There is certainly something wrong there. -- John Hasler jhas...@newsguy.com Elmwood, WI USA -- Sent via pgsql-sql mailing list (pgsql-sql@post

[SQL] What does PostgreSQL do when time goes backward?

2010-08-04 Thread John Hasler
How does PostgreSQL react to time being stepped at bootup? My Chrony NTP package might cause it to do so on rare occasions when the hardware clock is way off. This would only happen during bootup. -- John Hasler jhas...@newsguy.com Elmwood, WI USA -- Sent via pgsql-sql mailing list (pgsql

[SQL] How do you do the opposite of regexp_split_to_table?

2010-08-03 Thread John Gage
complementary action to regexp_split_to_table. Grouping by summing numerical fields seems to be straightforward, but grouping by concatenating text fields escapes my search of the documentation. Thanking you for your patience, John -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make

Re: [SQL] strangest thing happened

2010-07-07 Thread John
On Wednesday 07 July 2010 03:14:40 pm Justin Graf wrote: > I would be looking at the log files for the Inserts into that table as a > means to track down what is the cause.  If there are no log files or > don't have enough detail, crank up the logging level and wait for it to > happen again??? Th

Re: [SQL] strangest thing happened

2010-07-07 Thread John
; Search the logs to see what is calling nextval('My_Sequence') > > You may need to turn up logging to find it. > > On 7/7/2010 2:59 PM, John wrote: > > I am the only developer, DBA etc.. for a small project. Today (yesterday > > was everything was perfect) man

[SQL] strangest thing happened

2010-07-07 Thread John
I am the only developer, DBA etc.. for a small project. Today (yesterday was everything was perfect) many of the sequence numbers fell behind what is the actual PK value. For example the invoice PK sequence current value = 1056 but the table PK was 1071. Nobody (other than myself) knows how

Re: [SQL] is there a tutorial on window functions?

2010-06-11 Thread John
On Friday 11 June 2010 07:37:29 am Andreas Kretschmer wrote: > John wrote: > > Hi, > > I'd like to learn the use of window functions and did not find a tutorial > > using google ("postgres window function tutorial"). I'm hoping someone > > has a lin

[SQL] is there a tutorial on window functions?

2010-06-11 Thread John
Hi, I'd like to learn the use of window functions and did not find a tutorial using google ("postgres window function tutorial"). I'm hoping someone has a link. Johnf -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/

Re: [SQL] what does this do

2010-06-10 Thread John
st/datatype of the columns returned by the function). > > Doug > > > -Original Message- > From: pgsql-sql-ow...@postgresql.org > [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of John Sent: Thursday, > June 10, 2010 4:22 AM > To: pgsql-sql@postgresql.org > Sub

[SQL] what does this do

2010-06-10 Thread John
Hi, I have a piece of python code that excutes a SQL statement: apitempCur.execute("select * from jfcs_balancedue('%s') f(enrolleeid varchar, course_cost decimal, paid_amt decimal)" % (enrollIds,)); The "enrollids" is a list of primary keys and the "jfcs_balancedue" is a user defined function.

Re: [SQL] [GENERAL] Tsearch not searching 'Y'

2010-05-03 Thread John Gage
word. SELECT to_tsvector('simple', 'Andy andy The the in out'); to_tsvector - 'in':5 'out':6 'the':3,4 'andy':1,2 (1 row) John On Apr 29, 2010, at 4:01 PM, Tom Lane wrote: "sandeep prakash d

Re: [SQL] understanding select into

2010-04-09 Thread John
Wow thanks to all that replied - you folks are correct. The "_p" and the others are vars. _p RECORD; I won't forget that one for a long time (however, I do drink :-)) Johnf On Friday 09 April 2010 10:32:51 am Pavel Stehule wrote: > Hello > > 2010/4/9 John : >

[SQL] understanding select into

2010-04-09 Thread John
Hi, I am reviewing a function written by some xTuple guys. What is interesting about it is it uses the "INTO" statement like select something into _p from sometable where somecriteria. The function contiunes and uses the data retreived _p.somefield_name And then the function ends. Ok my que

[SQL] Dollar quoted strings

2010-03-25 Thread John Gage
doc's on dollar quoting. John On Mar 24, 2010, at 8:13 PM, Josh Kupershmidt wrote: On Wed, Mar 24, 2010 at 2:38 PM, John Gage wrote: In going through the arcana of string functions, I have come across the following series of selects that contain, for me, a mysterious "$re $".

[SQL] Help with reg_exp

2010-03-25 Thread John Gage
n this I get: regexp_matches -- I have not been able to find out what it all means. Forgive me for my blindness. John P.S. The author of the statements is "alexk" at Command Prompt. They are test statements against Postgres' string functions.

Re: [SQL] window function to sort times series data?

2010-03-24 Thread John Gage
been able to find out what it all means. Forgive me for my blindness. John P.S. The author of the statements is "alexk" at Command Prompt. They are test statements against Postgres' string functions.

[SQL] I, nead to capture the IP number from the PC how is running the script ...

2010-03-15 Thread John Dizaro
I, nead to capture the IP number from the PC how is running the script "update TABLE1 set campo1 = 123 where ...; " Can someone help me please? -- John Evan Dizaro - Fone: (41) -0303 Fone: (41) 9243-3240 Rua: Alferes Poli Curitiba - PR - Brasil

[SQL] determine the curval() of a view

2010-03-02 Thread John
Hi, I am working with a view that has a "_INSERT" rule. I'm wondering if there is a way to determine what the curval() of the PK (serial type) after an insert occurs. Given the name of the view I'd like to determine the sequence associated with the view's PK. Actually, I wonder if it is ev

[SQL] Partitioning improvements query

2010-02-04 Thread John Lister
s.pdf, http://wiki.postgresql.org/wiki/PgCon_2008_Developer_Meeting#Partitioning_Roadmap which mention improvements to partitioning, but I can't find any info if these have been acted on. Just curious as things like pushing limits down to the sub queries would be a great feature, etc Ch

Re: [SQL] Partitioning by letter question

2010-01-30 Thread John Lister
#x27; as the first result (ok not a word, but that is a different issue) but if i do select * from words where word <'.' order by word desc limit 10 I get '/...' as the first result, I would expect '', this doesn't seem consistent. I'm obviously m

[SQL] Partitioning by letter question

2010-01-29 Thread John Lister
ints are ignored, but this doesn't seem overly complicated. Am i doing something wrong or is there another better way to do this Thanks John -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Proper case function

2010-01-06 Thread John Summerfield
Michael Gould wrote: Gary, Based on what I read it wouldn't handle cases where the result should be MacDonald from macdonald. There are other cases such as the sentence below I've looked at rationalising names in this manner before, and found that, depending on the individual, both Macdonal

Re: [SQL] trouble with getting the field names

2009-10-26 Thread John
On Monday 26 October 2009 04:41:49 pm John wrote: > Below is a SQL statement that was created to retreive the primary key , and > column names and data types for a table name and a schema. The problem is > that is works very well if I only use the 'public' schema. But it does

[SQL] trouble with getting the field names

2009-10-26 Thread John
Below is a SQL statement that was created to retreive the primary key , and column names and data types for a table name and a schema. The problem is that is works very well if I only use the 'public' schema. But it does not work if I use a 'system' schema I created (owned my me). The offendi

Re: [SQL] two records per row from query

2009-08-07 Thread John
On Friday 07 August 2009 02:50:48 am Leo Mannhart wrote: > John wrote: > [snip] > > > I'm sorry I was attempting to simplify the problem. I will attempt to > > provide more info: > > > > OVERVIEW: > > "mytable" contains the dates of the

Re: [SQL] two records per row from query

2009-08-06 Thread John
On Thursday 06 August 2009 06:42:34 am Leo Mannhart wrote: > John wrote: > > mytable > > pkid > > class_date. > > sessionid > > > > select * from mytable > > 1 2009/01/01 2101 > > 2 2009/01/02 2101 > > > > I would like an SQ

Re: [SQL] two records per row from query

2009-08-06 Thread John
On Wednesday 05 August 2009 10:21:08 pm A. Kretschmer wrote: > In response to John : > > mytable > > pkid > > class_date. > > sessionid > > > > select * from mytable > > 1 2009/01/01 2101 > > 2 2009/01/02 2101 > > > > I

[SQL] two records per row from query

2009-08-05 Thread John
mytable pkid class_date. sessionid select * from mytable 1 2009/01/01 2101 2 2009/01/02 2101 I would like an SQL that would produce newtable pkid, class_date1, class_date2, sessionid1, sessionid2 Select * from newtable 1 2009/01/01 2009/01/02 2101 2101 I have a list of classes that is perfect

[SQL] Pgadmin hotkeys?

2009-05-25 Thread John Dizaro
Can somebody tell me please where i can find the PgAdmin Hotkey like Ctrl+SPACEBAR and others?? Tanks for all. -- John Evan Dizaro - Fone: (41) -0303 Fone: (41) 9243-3240 Rua: Alferes Poli Curitiba - PR - Brasil

Re: [SQL] Query planning question

2009-05-11 Thread John Lister
"John Lister" writes: Am I right in assuming the planner thinks a sequential scan is quicker than 10k index hits, would tweaking the costs fix this or would i be better updating the stats for the product_id and manufacturer_id fields? AFAICT the planner did exactly the right t

[SQL] Query planning question

2009-05-11 Thread John Lister
Doing the following query select distinct m.id, m.name from manufacturer_manufacturer m join product_product p on (p.manufacturer_id=m.id) join retailer_offer o on (o.product_id=p.id) where o.retailer_id=XXX and o.active results in one of 2 query plans depending upon the v

Re: [SQL] Comparing two tables of different database

2009-05-01 Thread John Zhang
Hi Nicholas, The query is across database query. dblink is needed for that task. Hope it helps, John On Thu, Apr 30, 2009 at 3:07 PM, Edward W. Rouse wrote: > Can’t you use this? > > > > select name from database2.sr_1 where name not in (select name from > database2.pr_1

Re: [SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread John DeSoi
ction test () returns void as $$ declare rec record; begin for rec in select * from whatever loop insert into some_table values (rec.*); end loop; end; $$ language plpgsql; John DeSoi, Ph.D. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.or

Re: [SQL] pl/pgsql or control structures outside of a function?

2009-04-03 Thread John DeSoi
CASE might work for you. http://www.postgresql.org/docs/8.3/interactive/functions-conditional.html John DeSoi, Ph.D. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

[SQL] Add column by using SELECT statement

2009-02-24 Thread John Zhang
tblA.Id=tblB.Id Any advice? Any input would be much appreciated. Thanks a lot John

[SQL] temp tables versus normal tables

2009-02-16 Thread John Lister
into" and bypass the table althogether but i'm guessing this would be slower as the data would need to be looked up each time the view is used for the subsequent processing steps.. Any thoughts Thanks JOHN -- Got needs? Get Goblin'! - http://www.pricegoblin.co.uk/

  1   2   3   >