This is an approach I also considered, but hoped for a solution without the
expense (albeit small) of having to create a function.
How about this query?
CREATE TABLE transactions (
item_code text,
_date date,
qty double precision
)
;
INSERT INTO transactions
gmb wrote
item_code | _date| qty | max
-
ABC | 2013-04-05 | 10.00| 2013-04-05
ABC | 2013-04-06 | 10.00| 2013-04-06
ABC | 2013-04-06 | -2.00| 2013-04-06
David Johnston wrote
Basic idea: use ORDER BY in the window to auto-define a range-preceding
frame. Create an array of all dates (tags in the example) that match with
positive amounts. Negative amounts get their matching tag added to the
array as NULL. The provided function looks into the
I have a record with the following fields:
id1, id2, id3, id4, price1, price2, price3, price4
I would like to write a SELECT statement in order to get 4 records:
id, price (record that comes from id1 and price 1)
id, price (record that comes from id2 and price 2)
id, price (record that comes
JORGE MALDONADO jorgemal1...@gmail.com hat am 24. Dezember 2012 um 17:30
geschrieben:
I have a record with the following fields:
id1, id2, id3, id4, price1, price2, price3, price4
I would like to write a SELECT statement in order to get 4 records:
id, price (record that comes from id1 and
hello,
( select 'A' as x, id, price from tab where id = 'value'
union all select 'B' as x, id, ...
union all select 'C' as x, id, ...
union all select 'D' as x, id, price from tab where id = 'value' )
generate a list like
X id price
A 1 10
B 2 20
C 3 30
D 4 40
select
Hi to everyone,
I have a little problem to retrieve data from multidimensional array. For
example, if I have this array
foo[][] = {{5,3},{2,2}}
how can I retrieve one of two internal array (for example I would to
retrieve {5,3}?
I tried foo[1:1] but the result is {{5,3}}, not {5,3}.
Is a
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of mephysto
Sent: Thursday, September 27, 2012 6:12 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Help in accessing array
Hi to everyone,
I have a little problem
Hi,
I want to do a check on a column if other columns meet certain
conditions. The program I'm working with allows to create additional
columns on every 'object' - called extra data, but I have no control
over the program. I want to enforce the values on this one extra data
to be of type
On Mar 13, 2012, at 14:29, M. D. li...@turnkey.bz wrote:
Hi,
I want to do a check on a column if other columns meet certain conditions.
The program I'm working with allows to create additional columns on every
'object' - called extra data, but I have no control over the program. I want
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
Harald Fuchs hari.fu...@gmail.com wrote:
hi, i am fairly new in postgresql, so if anyone can help me would be great
if i simply do:
select ver_no
from version
order by ver_no
the result will be something like this:
.1.3.1
.1.3.2.5.
.1.4.1.7.12
.1.4.11.14.7.
.1.4.3.109.1.
.1.4.8.66.
hi, i am fairly new in postgresql, so if anyone can help me would be great
if i simply do:
select ver_no
from version
order by ver_no
the result will be something like this:
.1.3.1
.1.3.2.5.
.1.4.1.7.12
.1.4.11.14.7.
.1.4.3.109.1.
.1.4.8.66.
so as you can see first 3 lines
James Bond coolof...@hotmail.com wrote:
hi, i am fairly new in postgresql, so if anyone can help me would be great
if i simply do:
select ver_no
from version
order by ver_no
the result will be something like this:
.1.3.1
.1.3.2.5.
.1.4.1.7.12
.1.4.11.14.7.
.1.4.3.109.1.
In article snt102-w49402a41c6b6599f082d35a8...@phx.gbl,
James Bond coolof...@hotmail.com writes:
hi, i am fairly new in postgresql, so if anyone can help me would be great
if i simply do:
select ver_no
from version
order by ver_no
the result will be something like this:
.1.3.1
Yep, that did it.
Thanks!
2011/9/23 Filip Rembiałkowski plk.zu...@gmail.com:
2011/9/22 Brian Sherwood bds...@gmail.com
select (xpath('/chassis-inventory/chassis/serial-number/text()',
data_xml,
ARRAY[ARRAY['junos',
'http://xml.juniper.net/junos/9.6R4/junos-chassis']]
I am trying to use xpath to extract some information from a XML document.
(if it matters, It's the router config for a Juniper router)
I believe I am having problems with the namespace.
I am trying to extract the serial-number, but I am not getting anything.
Here is the script I have been
2011/9/22 Brian Sherwood bds...@gmail.com
select (xpath('/chassis-inventory/chassis/serial-number/text()',
data_xml,
ARRAY[ARRAY['junos',
'http://xml.juniper.net/junos/9.6R4/junos-chassis']]
)) from xml_test;
Can anyone suggest how I would go about getting the
I am struggling a bit to do the following type of update in a table.
I want the content of a field updated like this:
Original:
'0894396e-16bf-4e63-aa52-97fe7031eec9||50a6b47c-f69c-414d-bcb6-14bbe403de5f|||'
After update:
Johann Spies jsp...@sun.ac.za wrote:
I am struggling a bit to do the following type of update in a table.
I want the content of a field updated like this:
Original:
'0894396e-16bf-4e63-aa52-97fe7031eec9||50a6b47c-f69c-414d-bcb6-14bbe403de5f|||'
After update:
', datetime)
),
datetimes AS
(
SELECT datetime
FROM subset
GROUP BY datetime
HAVING COUNT(*) = (SELECT COUNT(*) FROM pontos)
)
SELECT max(datetime)
FROM datetimes
;
From: saulo.venan...@gmail.com
Date: Wed, 20 Apr 2011 17:10:32 -0300
Subject: [SQL] help on select
On 2011-04-20, Saulo Venâncio saulo.venan...@gmail.com wrote:
--bcaec52e65e9b2f22304a15f3840
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi guys,
I need your help.
I have a table called medidas, in this table i have some ocurrences that ha=
s
Hi guys,
I need your help.
I have a table called medidas, in this table i have some ocurrences that has
id_medida(primary key) id_ponto (sec_key) and also datetime field as
timestamp.
i would like to know from a set of idpontos, e.g. 10,11,23,24 how can i
get the most recent date that is
I have table created as follows
CREATE TABLE D_2147483927_2147484848_TAB(
CP VARCHAR(256) ,
CPR VARCHAR(256) ,
CHOUSENO VARCHAR(256) ,
CSTREET VARCHAR(256) ,
CLOCALITY VARCHAR(256) ,
CCITY VARCHAR(256) ,
CPROVINCE VARCHAR(256) ,
CCOUNTRY VARCHAR(256) ,
CZIP VARCHAR(256) ,
CCO
On 01/17/2011 05:59 AM, Amar Dhole wrote:
I have table created as follows
CREATE TABLE D_2147483927_2147484848_TAB(
CP VARCHAR(256) ,
CPR VARCHAR(256) ,
CHOUSENO VARCHAR(256) ,
CSTREET VARCHAR(256) ,
CLOCALITY VARCHAR(256) ,
CCITY VARCHAR(256) ,
CPROVINCE VARCHAR(256) ,
CCOUNTRY
COPY D_2147483927_2147484848_TAB
(
CP
, CPR
, CHOUSENO
, CSTREET
, CLOCALITY
, CCITY
, CPROVINCE
, CCOUNTRY
, CZIP
)
FROM 'one.txt'
WITH DELIMITER ',' QUOTE '' csv HEADER;
On Mon, Jan 17, 2011 at 7:59 AM, Amar
Thanks this solves my problem..
From: filip.rembialkow...@gmail.com [mailto:filip.rembialkow...@gmail.com] On
Behalf Of Filip Rembialkowski
Sent: Wednesday, January 12, 2011 1:41 AM
To: Amar Dhole
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] help needs
Hi,
I need helping converting following db2 function in postgresql function.
Any pointer will be great help in proceeding me ahead.
CREATE FUNCTION in_liststring ( string CLOB(64K) )
RETURNS TABLE ( ordinal INTEGER, index INTEGER )
LANGUAGE SQL
DETERMINISTIC
NO EXTERNAL ACTION
2011/1/11 Amar Dhole adh...@tibco.com
Hi,
I need helping converting following db2 function in postgresql function.
Any pointer will be great help in proceeding me ahead.
CREATE FUNCTION in_liststring ( string CLOB(64K) )
RETURNS TABLE ( ordinal INTEGER, index INTEGER )
LANGUAGE SQL
Hello Postgres Team
My environment is 8.4.5 I use PGADMIN 1.10. I've written a function in which
I'm having difficulty debugging to determine whether I have a logic error or
what I'm attempting to do is not possible in plpgsql? Understand that I come
from the Windows and Microsoft World. I'm use
Dear group,
I just started learning postgres and I have to analyze my data. So
please bear with me, for all the simple questions that I am asking.
Apologies.
I have a table:
snps table
id | sample_id | chromosome | from | to |
Howdy, Adrian,
Please see my questions below
snps table
id | sample_id | chromosome | from | to |
1 1chr1 10 11
2 1 chr1 14 15
3 2
Hello Oliver.
thanks for your reply. Here are my answers. Sorry I shot e-mail in
morning and I was not clear about it.
I am afraid, I am not jamming you with all information.
Thank you very much for your help.
== your questions
Hi,
I need to display log events (again).
The log is simply like this
log ( log_id serial primary key, create_ts timestamp default
localtimestamp, object_id, state_id, ... )
It records the state of objects and when and what happend to to change
this state.
I'd like to get a list that
In response to Andreas :
Hi,
I need to display log events (again).
The log is simply like this
log ( log_id serial primary key, create_ts timestamp default
localtimestamp, object_id, state_id, ... )
It records the state of objects and when and what happend to to change
this state.
Or even simpler, or easier to understand:
SELECT trim(foo, '()') FROM foobar
pozdrowienia / regards / salutations
mk
2010/5/5 Nicholas I nicholas.domni...@gmail.com
Hi,
I have a table in which the data's are entered like,
Example:
One (1)
Two (2)
Three (3)
I want to extract the
--- On Thu, 27/5/10, James Kitambara jameskitamb...@yahoo.co.uk wrote:
From: James Kitambara jameskitamb...@yahoo.co.uk
Subject: Re: [SQL] help
To: Nicholas I nicholas.domni...@gmail.com
Date: Thursday, 27 May, 2010, 14:50
Hello Mr. Nicholas,
You can try the following:
THIS IS WHAT
Hi,
I have a table in which the data's are entered like,
Example:
One (1)
Two (2)
Three (3)
I want to extract the data which is only within the parentheses.
that is
1
2
3
Thank You
Nicholas I
select substring( data from '\((.*)\)' ) from table;
2010/5/5 Nicholas I nicholas.domni...@gmail.com:
Hi,
I have a table in which the data's are entered like,
Example:
One (1)
Two (2)
Three (3)
I want to extract the data which is only within the parentheses.
that is
1
2
3
In response to Nilesh Govindarajan :
Hi,
I want to find out the userid, nodecount and comment count of the userid.
I'm going wrong somewhere.
Check my SQL Code-
Check my example:
test=*# select * from u;
id
1
2
3
(3 rows)
test=*# select * from n;
uid
-
1
1
1
Hi,
I want to find out the userid, nodecount and comment count of the userid.
I'm going wrong somewhere.
Check my SQL Code-
select u.uid, count(n.nid) nc , count(c.cid) cc from users u left join
node n on ( n.uid = u.uid ) left join comments c on ( c.uid = u.uid )
group by u.uid having
[I mistakenly used the wrong Subject line initially with this post]
In going through the arcana of string functions, I have come across the
following series of selects that contain, for me, a mysterious $re$.
-- return all matches from regexp
SELECT regexp_matches('
foobarbequebaz',
here is example
table name is mail:
column| type
-
sender|char
subject |char
content |bytea
I want copy some record into new table 'mail_new'.
sql:
create table mail_new as select * from mail sender='dennis'
result has an error:
operator does not exist:
Hi Ben
here is my function , it's for fix missing chunk problem.
It has same problem ,please take look
thank for you help
-table--
db=# \d usersessiontable;
Table public.usersessiontable
Column | Type | Modifiers
Postgres : 8.1.4
Dennis
Ben Morrow wrote:
Quoth dennisden...@teltel.com:
Dear Ben
thanks for you anwser.
I try to add function quote_literal on my sql statement .
but it raise other error message (quote_literal not support bytea format):
function quote_literal(bytea) does
Dear Ben
thanks for you anwser.
I try to add function quote_literal on my sql statement .
but it raise other error message (quote_literal not support bytea format):
function quote_literal(bytea) does not exist
Ben Morrow 提到:
Quoth dennis den...@teltel.com:
Hi Ben
here is my
Quoth dennis den...@teltel.com:
Dear Ben
thanks for you anwser.
I try to add function quote_literal on my sql statement .
but it raise other error message (quote_literal not support bytea format):
function quote_literal(bytea) does not exist
Which Postgres version are you
[quoting fixed]
Quoth dennis dennis.ma...@gmail.com:
Ben Morrow wrote:
Quoth dennisden...@teltel.com:
Dear Ben
thanks for you anwser.
I try to add function quote_literal on my sql statement .
but it raise other error message (quote_literal not support bytea format):
Quoth dennis den...@teltel.com:
Hi Ben
here is my function , it's for fix missing chunk problem.
It has same problem ,please take look
thank for you help
-table--
db=# \d usersessiontable;
Table public.usersessiontable
Column |
Quoth dennis den...@teltel.com:
here is example
table name is mail:
column| type
-
sender|char
subject |char
I presume you mean 'varchar'?
content |bytea
I want copy some record into new table 'mail_new'.
sql:
create table mail_new as
Quoth dennis den...@teltel.com:
I need to copy some data to new table.
But I encounter some error message.
the table structure
Table A:
c1 char
c2 bytea
Table B:
c1 char
c2 bytea
My sql command:
insert into B as select * from a where c1=xxx
'AS' isn't valid
dateadd() is not sql postgresql standard, it's mssql
in postgresql i only need to use +/- operators and interval for the same
function
dateadd('year', 1, '2008/1/1') == date '2008/1/1' + interval '1 year'
rafizeldi wrote:
Dear All
I need to simplify this query, It takes a lot of time to
possibly this answers my question, and what i am doing is indeed the most
appropriate?
Databases are physically separated and access control is managed at the
connection level.
from 8.3 docs, section 20.1
thanks,
Isaac
On Fri, May 22, 2009 at 2:37 AM, Isaac Dover isaacdo...@gmail.com wrote:
thank you _SO_ much. I'm not sure how I overlooked that, but it is far
easier to manage using connect. I'm assuming that even if tables have public
privileges granted, that they are not visible to people not granted connect
privileges to the database?
Thanks,
Isaac
On Fri, May 22, 2009 at 12:31
Isaac Dover isaacdo...@gmail.com writes:
thank you _SO_ much. I'm not sure how I overlooked that, but it is far
easier to manage using connect. I'm assuming that even if tables have public
privileges granted, that they are not visible to people not granted connect
privileges to the database?
Hi Pavel,
Thank you for your reply.
I tried the query and it is returning result as ,
for a single entry in sample info in separate rows
The result of the query as
1, prop1,value1
1,prop2,value2
2,prop1,value1
2 prop2,value2
2 prop3,value3
but i want the output as single row per sample id like
maria s escreveu:
I tried the query and it is returning result as ,
for a single entry in sample info in separate rows
The result of the query as
1, prop1,value1
1,prop2,value2
2,prop1,value1
2 prop2,value2
2 prop3,value3
but i want the output as single row per sample id like
2008/6/10 maria s [EMAIL PROTECTED]:
Hi Pavel,
Thank you for your reply.
I tried the query and it is returning result as ,
for a single entry in sample info in separate rows
The result of the query as
1, prop1,value1
1,prop2,value2
2,prop1,value1
2 prop2,value2
2 prop3,value3
but i
Hi Rosario,
Thanks for the link. I hope this will solve my problem.
Thanks,
Maria
On Tue, Jun 10, 2008 at 11:34 AM, Osvaldo Rosario Kussama
[EMAIL PROTECTED] wrote:
maria s escreveu:
I tried the query and it is returning result as ,
for a single entry in sample info in separate rows
The
On Tue, Jun 10, 2008 at 11:51 AM, maria s [EMAIL PROTECTED] wrote:
Hi Rosario,
Thanks for the link. I hope this will solve my problem.
It should be able to. Note that crosstab functions expect square
inputs from the select they run. I.e. you can't have empty columns,
you need to replace NULL
Hi Scott,
Thanks for the information. This is very useful for me.
I will be careful when forming the column.
Thanks,
-maria
On Tue, Jun 10, 2008 at 3:16 PM, Scott Marlowe [EMAIL PROTECTED]
wrote:
On Tue, Jun 10, 2008 at 11:51 AM, maria s [EMAIL PROTECTED] wrote:
Hi Rosario,
Thanks for the
Hi all,
I want the last value from the group of rows. The table 'index_prices' is
index_code price_time price
XYZ09:45:00 7.5
XYZ09:46:00 7.4
XYZ09:59:00 7.2
XYZ10:00:00 7.3
XYZ10:01:00 7.6
XYZ
Add something like this to your query:
ORDER BY price_time LIMIT 1
Cheers,
~p
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of roopa perumalraja
Sent: Monday, 19 March 2007 13:56
To: pgsql-sql@postgresql.org
Subject: [SQL] Help with sub query
I got some weird results when processing select statements with limit
and offset. I think its some kind of database corruption but I was
wondering what other's think.
Background:
The table I'm having the issue with is described below. The thing to
note is the primary key
ice=# \d
On Thu, 18 Jan 2007, Barbara Cosentino wrote:
Then I perform the following selects
SELECT host_id, host_datum_type_id, host_datum_source_id, data
FROM nc_host_datum INNER JOIN nc_host USING (host_id)
WHERE audit_id=2041
ORDER BY host_id
LIMIT 49 OFFSET 1372;
And
SELECT host_id,
I have a java application that moves data from our erp platform
(progress) into a Postgres database. One of the fields in progress is
a character array. I haven't had any luck getting this field to
transfer. What I would like to do is something like:
On 1/8/07, Jeremiah Elliott [EMAIL PROTECTED] wrote:
I have a java application that moves data from our erp platform
(progress) into a Postgres database. One of the fields in progress is
a character array. I haven't had any luck getting this field to
transfer. What I would like to do is
In GNUmed we have created a function
gm_concat_table_structure()
in
http://cvs.savannah.gnu.org/viewcvs/gnumed/gnumed/server/sql/gmSchemaRevisionViews.sql?rev=1.6root=gnumedview=log
which returns a reproducable, human-readable TEXT
concatenation of all the relevant parts of
Hi all,
Thanks for all replies, taking into account all your suggestions and
my google research I arrived to the next script. I'd like to know your
opinion. Hopefully this will be useful for somebody else.
--used to stop the script execution on any error
I'd probably make a small change to make this a little cleaner.
Specifically, change check_version() to take an argument, which is the
needed version, and check this against the current value in
agenda_version, throwing the exception if they don't match. Once you've
written this, you'll never
Hi all!,
I've got the following problem and I don't know how to solve it in
PostgreSQL.
I'd like to add a version checking to my db scripts. That is, I have
the db creation scripts and the changes/upgrade script, and there is a
table inside each db that holds the version of script
Hi Daniel,
You should define a PL/PGSQL function such as:
CREATE OR REPLACE FUNCTION check_version()
RETURNS void
AS $$
DECLARE
v_version VARCHAR;
BEGIN
SELECT version INTO v_version FROM version WHERE id = 1;
IF v_version '1.0.0.0' THEN
RAISE EXCEPTION 'This script needs
Arnau [EMAIL PROTECTED] writes:
I don't want, if it's possible, to create a function.
Unlike Oracle, PG makes a strong distinction between SQL and
programmable languages (including plpgsql). You can't write
plpgsql code without putting it into a function.
regards,
Tom Lane wrote:
Arnau [EMAIL PROTECTED] writes:
I don't want, if it's possible, to create a function.
Unlike Oracle, PG makes a strong distinction between SQL and
programmable languages (including plpgsql). You can't write
plpgsql code without putting it into a function.
Arnau wrote:
Tom Lane wrote:
Arnau [EMAIL PROTECTED] writes:
I don't want, if it's possible, to create a function.
Unlike Oracle, PG makes a strong distinction between SQL and
programmable languages (including plpgsql). You can't write
plpgsql code without putting it into a function.
Can you do the whole thing inside a transaction context (both the
version check and the updates)? The exception should cause the
transaction to bail out, and the updates won't proceed.
Thus:
BEGIN;
SELECT check_version();
UPDATE agenda_version set version = '1.0.0.1' where id = 1;
COMMIT;
I
I tried to do the following in PostgreSQL:
DECLARE
v_version VARCHAR;
BEGIN
SELECT version INTO v_version FROM version WHERE id = 1;
IF v_version ''1.0.0.0'' THEN
RAISE EXCEPTION ''This script needs Agenda version 1.0.0.0,
detected version %'', v_version;
END IF;
Hi all,
I am trying to alter the column lenght of the table which has 500 child
tables by sql command.
alter table ticks alter column qualifiers type varchar(500);
the error is
ERROR: cannot alter type of a column used by a view or rule
DETAIL: rule
It makes sense when ya'll explain it
It never sounds that good when I'm talkin to myself
That solves my problem but not my ignorance
I'm still curious about how would I properly quote
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a
Richard Ray wrote:
It makes sense when ya'll explain it
It never sounds that good when I'm talkin to myself
That solves my problem but not my ignorance
I'm still curious about how would I properly quote
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
end
$$ language 'plpgsql';
I'm not having a lot of luck
Thanks
Richard
Try
select into a now() - interval ($1 || ' day')
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Richard Ray
Sent: Tuesday, December 19, 2006 3:10 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Help with quotes in plpgsql
How should this be properly
Richard Ray написа:
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
end
$$ language 'plpgsql';
I'm not having a lot of luck
Welcome
$$ language 'plpgsql';
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Richard Ray
Sent: Tuesday, December 19, 2006 12:10 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Help with quotes in plpgsql
How should this be properly quoted
create
@postgresql.org
Subject: [SQL] Help with quotes in plpgsql
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
end
$$ language 'plpgsql';
I'm
On Tue, 19 Dec 2006, Milen A. Radev wrote:
Richard Ray :
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
end
$$ language 'plpgsql';
am Tue, dem 19.12.2006, um 14:09:37 -0600 mailte Richard Ray folgendes:
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
end
$$ language
Richard Ray написа:
On Tue, 19 Dec 2006, Milen A. Radev wrote:
Richard Ray :
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
;
return next a;
return;
end
$$ language 'plpgsql';
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Milen A. Radev
Sent: Tuesday, December 19, 2006 2:54 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help with quotes in plpgsql
Richard Ray написа
Hector Villarreal [EMAIL PROTECTED] writes:
select into a now() - ($1::text||'days')::interval;
People keep suggesting variants of that as ways to convert numeric
values to intervals, but it's really extremely bad practice. Much
better is to use number-times-interval multiplication:
, August 17, 2006
8:58 PM
To: MaXX
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help with
optional parameters
BEGIN
query_base := 'SELECT * FROM my_table ';
has_param := FALSE;
query_where := '';
IF (a IS NOT NULL) THEN
IF (has_param IS FALSE)THEN
-- there is no param yet add WHERE
Curtis Scheer wrote:
I noticed this one by searching in the archives, as I am working with
some
optional parameters myself and noticed your solution. I just wanted to
make one improvement suggestion which is instead of checking whether
or not
a parameter has been used simply start your
Hi, Tom,
Tom Lane wrote:
If film_id is a primary key for film, then it's actually legal per SQL99
(though not in earlier SQL specs) to just GROUP BY film_id and then
reference the other columns of film without explicit grouping, because
clearly there can be only one value of them per film_id
Hi all. I'm with a little doubt.I'm testing the pagila (the postgres port of mysql sakila sample).Well, I was trying to translate the query:select film.film_id AS FID, film.title
AS title, film.description AS description, category.name AS category, film.rental_rate AS price,
On Fri, Sep 01, 2006 at 10:31:48AM -0300, Walter Cruz wrote:
ERROR: column film.description must appear in the GROUP BY clause or be
used in an aggregate function
If I put that column on GROUP BY everything works ok. But I want understant
why do I need to do that. Can someone teach me,
So I can assume that the MySQL implementation is strange? (It accepts that kind of query)[]'s- WalterOn 9/1/06, Andrew Sullivan
[EMAIL PROTECTED] wrote:On Fri, Sep 01, 2006 at 10:31:48AM -0300, Walter Cruz wrote:
ERROR:column film.description must appear in the GROUP BY clause or be used in an
On Fri, Sep 01, 2006 at 02:26:39PM -0300, Walter Cruz wrote:
So I can assume that the MySQL implementation is strange? (It accepts that
kind of query)
In my experience, it is almost never safe to assume that the MySQL
approach to SQL bears anything but a passing resemblance to SQL
proper. This
But, when I add another column on select, like, film_description, I get
the following error:
ERROR: column film.description must appear in the GROUP BY clause or
be used in an aggregate function
If I put that column on GROUP BY everything works ok. But I want
understant why do I need to
On Fri, 2006-09-01 at 12:26, Walter Cruz wrote:
So I can assume that the MySQL implementation is strange? (It accepts
that kind of query)
Yes, according to the SQL spec, you should generally get an error when
you run a query like this:
select field1, field2 from table group by field1
since
Andrew Sullivan [EMAIL PROTECTED] writes:
On Fri, Sep 01, 2006 at 02:26:39PM -0300, Walter Cruz wrote:
So I can assume that the MySQL implementation is strange? (It accepts that
kind of query)
In my experience, it is almost never safe to assume that the MySQL
approach to SQL bears anything
1 - 100 of 417 matches
Mail list logo