Re: [SQL] Number timestamped rows

2011-11-08 Thread Jasen Betts
On 2011-11-02, Jan Peters wrote: > Dear all, > maybe a stupid question, but: I have a table that is ordered like this: > Tables aren't ordered. Sometimes they may seem to be ordered, but they seldom stay that way for long. > and I would like to number them according to their timestamps like th

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

2011-11-08 Thread Jasen Betts
On 2011-11-07, Richard Huxton wrote: > On 05/11/11 00:12, John Fabiani wrote: > OK, so it seems psycopg is quoting your strings for you (as you'd > expect). It's presumably turning your query into: > ... values (E'123', $$E''$$) > So - the $$ quoting is unnecessary here - just use the % pla

Re: [SQL] GROUP and ORDER BY

2011-11-08 Thread Tarlika Elisabeth Schmitz
On Tue, 08 Nov 2011 09:57:08 +0530 Robins Tharakan wrote: >On 11/08/2011 02:50 AM, Tarlika Elisabeth Schmitz wrote: >> Hello, >> >> I would like to GROUP the result by one column and ORDER it by >> another: >> >> SELECT >> no, name, similarity(name, 'Tooneyvara') AS s >> FROM vtown >>

[SQL] Issue with a variable in a function

2011-11-08 Thread tlund79
I've created a function which purpose is to import data to an excel report. This is however the first time I'm doing this, and I've exhausted all other options before asking the question here. I call this function with this command: select ppr_data(2011,1,52,8) The issue relates to the variable "

Re: [SQL] GROUP and ORDER BY

2011-11-08 Thread Robins Tharakan
Hmmm... Missed that! I think you are looking for the feature that was introduced in PostgreSQL 9.1 where you could have a non-group-by column in the select list, but only if the group-by has a pkey to identify the actual row. http://www.postgresql.org/docs/9.1/static/release-9-1.html (Search

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-08 Thread Sylvain Mougenot
Hello, I'm trying to use table partitionning on a table called JOB. Each month a new table is created to contain the rows created on that month. ex : JOB_2011_11 for rows created during november 2011. To do that I followed this advices on that page : http://www.postgresql.org/docs/9.1/static/ddl-p

Re: [SQL] Issue with a variable in a function

2011-11-08 Thread David Johnston
-Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of tlund79 Sent: Tuesday, November 08, 2011 8:17 AM To: pgsql-sql@postgresql.org Subject: [SQL] Issue with a variable in a function The issue relates to the variable "prosjektkode" ($

[SQL] Updatable view should truncate table fields

2011-11-08 Thread Russell Keane
Using PostgreSQL 9.0. We have a table which is not accessible by client code. We also have views with rules and triggers to intercept any insert or update statements and write that data in a slightly different format back to the table. A particular field in the table is currently 5 chars but rec

Re: [SQL] Updatable view should truncate table fields

2011-11-08 Thread David Johnston
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Russell Keane Sent: Tuesday, November 08, 2011 4:34 PM To: pgsql-sql@postgresql.org Subject: [SQL] Updatable view should truncate table fields Using PostgreSQL 9.0. We have a table which is not accessible by

Re: [SQL] help with xpath namespace

2011-11-08 Thread Ross Reedstrom
On Mon, Sep 26, 2011 at 09:56:06AM -0400, Brian Sherwood wrote: > Yep, that did it. > > Thanks! ProTip (for the list archive): since the namespace alias in the query and the original XML don't need to match (in this common case, the document uses a default namespace, which isn't available in xpat

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-08 Thread Josh Kupershmidt
On Tue, Nov 8, 2011 at 11:04 AM, Sylvain Mougenot wrote: > EXECUTE 'INSERT INTO '|| currentTableName || ' values (NEW.*)'; The quotes in the above line are wrong; you want it like: EXECUTE 'INSERT INTO '|| currentTableName || ' values ' || (NEW.*); Josh -- Sent via pgsql-sql mailing list (pgs