SELECT cols,
SUM( CASE WHEN cf = 1 THEN 1 ELSE 0 END ) AS sum_1,
SUM ( CASE WHEN cf = 0 THEN 1 ELSE 0 END ) AS sum_0
FROM table
WHERE cf IN (0, 1)
GROUP BY cols
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Andreas Forø Tollefsen
Sent:
Replace the 1 in the case with area
like the msi77 said
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of David Johnston
Sent: Monday, August 15, 2011 9:08 AM
To: 'Andreas Forø Tollefsen'; pgsql-sql@postgresql.org
Subject: Re: [SQL] Calculate
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of adam_pgsql
Sent: Tuesday, August 16, 2011 7:39 AM
To: pgsql-sql
Subject: [SQL] which is better: using OR clauses or UNION?
Hi,
I have a query hitting a table of 25 million rows.
I have to deal with a table which contains:
first_name
surname
email1
email2
... and I would like to create a view which combines both email columns
thus:
first_name
surname
email
It looks simple but I can't think of an obvious query.
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On
Behalf Of Viktor Bojovic
Sent: Wednesday, August 31, 2011 5:27 PM
To: pgsql-sql@postgresql.org; pgsql-ad...@postgresql.org
Subject: [SQL] function based index problem
Hi,
on table entry (17M records) there is
On Sep 1, 2011, at 14:13, Charlie scorpda...@hotmail.com wrote:
Could I get feedback from the community on schema partitioning?
I'm doing maintenance on my ddl and I'm noticing that my tables are all in 1
schema, but they have prefixes on their names like table_app1_sometable,
On Sep 17, 2011, at 9:32, R. Smith ship.quo...@gmail.com wrote:
What I want to do is do a query joining table A with B and sorting
firstly on a field in Table A then on several fields in Table B.
SELECT a.gdn_gdn, a.gdn_custref, a.gdn_date, a.gdn_address_name,
a.gdn_method,
On Sep 20, 2011, at 5:58, Thomas Kellerer spam_ea...@gmx.net wrote:
I'm just wondering if this is intended behavioury, simply not (yet)
implemented or even invalid according to the standard? I didn't find any
reference that it's not allowed in the manual.
Regards
Thomas
Try
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Samuel Gendler
Sent: Wednesday, September 21, 2011 7:35 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] ambiguous local variable name in 9.0 proc
I've got a stored proc (which worked fine in 8.3 and
On Sep 22, 2011, at 22:49, John Fabiani jo...@jfcomputer.com 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 my
query.
If I
select max(x.date_field) as special_date from (select
On Sep 25, 2011, at 12:37, R. Smith ship.quo...@gmail.com wrote:
On Sat, Sep 17, 2011 at 2:56 PM, David Johnston pol...@yahoo.com wrote:
On Sep 17, 2011, at 9:32, R. Smith ship.quo...@gmail.com wrote:
What I want to do is do a query joining table A with B and sorting
firstly on a field
So my questions are: 1) How do we cause the paymentcalc function to be
executed only once? and 2) How do we call a table returning function with
inputs from a table?
Thank you very much!
Steve
WITH func AS (
SELECT FUNC(...) AS func_result FROM ...
)
SELECT (func.func_result).*
On Oct 22, 2011, at 6:41, Linos i...@linos.es wrote:
Hi all,
i need a little of advice on what could be the best way to store this
information.
We need to calculate the difference in costs for our operations, we are
already
storing our vendor invoices in the database so calculate the
On Oct 24, 2011, at 22:54, Craig Ringer ring...@ringerc.id.au wrote:
On 25/10/11 03:23, Brice André wrote:
Hello everyone,
I am developping a web service where some tables are handling the data
of different clients. Depending on configured rights, one client can
have no access, or read
On Oct 22, 2011, at 10:07, Pavel Stehule pavel.steh...@gmail.com wrote:
2011/10/22 David Johnston pol...@yahoo.com:
On Oct 22, 2011, at 6:41, Linos i...@linos.es wrote:
Hi all,
i need a little of advice on what could be the best way to store this
information.
We need to calculate
On Nov 4, 2011, at 10:01, Russell Keane russell.ke...@inps.co.uk wrote:
I’m trying to create a custom type (PostgreSQL 9.0) which will essentially
auto truncate a string to a certain length.
Can this be done purely in plpgsql?
If so, how?
An explicit cast of a value to
On Nov 4, 2011, at 11:26, John Fabiani jo...@jfcomputer.com 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 of
single quotes in the string (or other strange char's). However, I noticed
that the
-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
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
On Nov 11, 2011, at 8:38, the6campbells the6campbe...@gmail.com wrote:
consider the following
create table TARRBINT ( RNUM integer not null , CARRBINT bigint array[5] ) ;
Can someone clarify why Postgres does not like examples 2, 6 and 7
An array must have a base type; an empty array
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Rob Sargent
Sent: Tuesday, November 22, 2011 10:30 AM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] Change in 9.1?
On 11/22/2011 12:39 AM, Jasmin Dizdarevic wrote:
Hi,
we
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On
Behalf Of Pavel Stehule
Sent: Thursday, December 08, 2011 2:40 AM
To: Vad N
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] prepared statements
Hello
2011/12/8 Vad N vadi...@gmail.com:
On Dec 10, 2011, at 11:03, Richard Klingler rich...@klingler.net wrote:
Good day...
I'm trying to build a query for PGSQL 9.1 where a table has two
references with only one being used depending of the type of entry..
For example, the table has following simplified structure:
portid
On Dec 15, 2011, at 23:16, John Fabiani jo...@jfcomputer.com wrote:
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
From is not required if you use literals or function results (with literal
input parameters). If you reference something that is not one of these it has
to come from somewhere and that location is the from/join part of the query.
In your query foo.work_date is not a literal or function and so
On Dec 29, 2011, at 23:25, Jan Bakuwel jan.baku...@greenpeace.org wrote:
Hi,
Maybe there is a simple solution for PostgreSQL behaviour that is
annoying me...
I've got users making updates to a master table and a number of detail
tables. All changes to the master record and related detail
On Dec 30, 2011, at 21:53, John Poole jlpool...@gmail.com 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 I used to set up my
On Jan 11, 2012, at 19:30, Carlos Mennens carlos.menn...@gmail.com wrote:
On Wed, Jan 11, 2012 at 7:13 PM, David Johnston pol...@yahoo.com wrote:
However, I will say again, you DO NOT WANT TO ACTUALLY DO THIS!
The specific issue is that some US Postal Code begin with a zero ( 0 ) and
so
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Carlos Mennens
Sent: Thursday, January 12, 2012 11:43 AM
To: PostgreSQL (SQL)
Subject: [SQL] Unable To Modify Table
I seem to have an issue where I can't modify a table due to
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Carlos Mennens
Sent: Thursday, January 26, 2012 6:59 PM
To: PostgreSQL (SQL)
Subject: [SQL] Update Mass Data in Field?
I'm new to SQL so I'm looking for a way to change several
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Edward W. Rouse
Sent: Tuesday, January 31, 2012 3:27 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] must appear in the GROUP BY clause or be used in an aggregate
function problem
On Feb 2, 2012, at 0:16, tiplip chengwe...@gmail.com wrote:
Hi all,
I have a couple of tables with same structure but standing for different
layers(1,2,3...) respectivle for Mapserver,
table1
gid| id| name | address| post code | layer
| geom
On Feb 2, 2012, at 0:32, tiplip chengwe...@gmail.com wrote:
I just need gid or id in increasing order start from 0 (or 1), fetching their
original gid (or id) value is not necessary:)
can I do that?
David Johnston wrote
The general method is to use UNION but not sure about
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of ssylla
Sent: Wednesday, February 08, 2012 9:31 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] update column with multiple values
Dear list,
sorry, I already posted this, but it
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On
Behalf Of Andreas
Sent: Wednesday, February 15, 2012 8:03 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] need help with import
Hi
I get CSV files to import.
Th structure is like this.
main
On Feb 15, 2012, at 21:05, Andreas maps...@gmx.net wrote:
Am 16.02.2012 02:13, schrieb David Johnston:
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Andreas
Sent: Wednesday, February 15, 2012 8:03 PM
To: pgsql-sql
On Feb 16, 2012, at 20:01, vpapavas vicky.papa...@gmail.com wrote:
Hello all,
I am trying to use this query in a toy database with customers and orders in
order to understand the capabilities of partitioning. In plain english what
I want to do is to select the orders of each customer and
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
You would need to install the HSTORE extension to convert the record into
a key-value pair then perform the comparison on that.
Dave
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Rehan Saleem
Sent: Monday, March 19, 2012 3:40 PM
To:
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of Richard Huxton
Sent: Monday, March 19, 2012 4:59 PM
To: David Johnston
Cc: 'Rehan Saleem'; pgsql-sql@postgresql.org
Subject: Re: [SQL] Postgresql function which compares
Documented behavior. Please read the section on UNION for the why and the
proper alternative syntax:
http://www.postgresql.org/docs/9.0/interactive/sql-select.html
On Mar 28, 2012, at 7:01, Gary Stainburn gary.stainb...@ringways.co.uk wrote:
Hi folks.
I have two selects which in
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Andreas
Sent: Tuesday, April 24, 2012 5:35 PM
To: Samuel Gendler
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] generic crosstab ?
Am 24.04.2012 22:08, schrieb Samuel Gendler:
On Tue, Apr 24, 2012
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of Carlos Mennens
Sent: Friday, May 11, 2012 3:04 PM
To: PostgreSQL (SQL)
Subject: [SQL] Finding Max Value in a Row
I have a problem in SQL I don't know how to solve and
On Jun 1, 2012, at 10:34, Relyea, Mike mike.rel...@xerox.com wrote:
I need a little help putting together a query. I have the tables listed
below and I need to return the lowest two consumables (ranked by cost
divided by yield) per printer, per color of consumable, per type of
consumable.
On Jun 6, 2012, at 11:08, John Fabiani jo...@jfcomputer.com wrote:
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
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of John Fabiani
Sent: Thursday, June 07, 2012 7:18 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] using ordinal_position
I'm attempting to retrieve data using a select
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of Rihad
Sent: Thursday, June 21, 2012 1:49 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Need help building this query
Hi, folks. I currently need to join two tables that
On Jun 27, 2012, at 21:07, Andreas maps...@gmx.net wrote:
Hi
I do keep a table of objects ... let's say companies.
I need to collect flags that express yes / no / don't know.
TRUE / FALSE / NULL would do.
Solution 1:
I have a boolean column for every flag within the
On Jul 22, 2012, at 23:04, ssylla stefansy...@gmx.de wrote:
Dear list,
assuming I have two tables as follows
t1:
id_project|id_auth
1|1
2|2
t2:
id_project|id_auth
1|2
2|1
and a lookup-table:
t3
id_auth|name_auth
1|name1
2|name2
Now I want to query t1
On Jul 27, 2012, at 21:57, Andreas maps...@gmx.net wrote
Hi,
I have a table with user ids and names.
Another table describes some rights of those users and still another one
describes who inherits rights from who.
A function all_rights ( user_id ) calculates all rights of a user
-Original Message-
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
ow...@postgresql.org] On Behalf Of amit sehas
Sent: Tuesday, August 14, 2012 12:55 PM
To: pgsql-sql@postgresql.org; pgsql-gene...@postgresql.org
Subject: [GENERAL] Indexing question
In SQL, given a
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Alex
Sent: Friday, August 17, 2012 11:58 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Error: Template Id should be teh identifier of a template -
help
Hi, All!
When I execute this:
UPDATE HTMLPAGE SET
On Aug 31, 2012, at 21:53, Samuel Gendler sgend...@ideasculptor.com wrote:
I have the following crosstab query, which needs to be parameterized in the 2
inner queries:
SELECT * FROM crosstab(
$$
SELECT t.local_key,
s.sensor_pk,
CASE WHEN
Yelai,
The etiquette on this list is to place all replies either in-line (but
following the content being quoted) or at the end of the posting.
My reply is at the end.
=By: Sergey Konoplev
If you do not need information about column types you can use hstore for
this purpose.
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of James Sharrett
Sent: Saturday, September 08, 2012 6:24 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] returning values to variables from dynamic SQL
I have a PG function ( using plpgsql) that calls a number
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of JORGE MALDONADO
Sent: Sunday, September 09, 2012 1:26 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Query with LIMIT clause
I have the following records that I get from a query, the fields are date
type in
of both initial
and final date?
Regards,
Jorge Maldonado
On Sun, Sep 9, 2012 at 12:45 PM, David Johnston pol...@yahoo.com wrote:
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of JORGE MALDONADO
Sent: Sunday, September 09, 2012 1:26 PM
To: pgsql
On Sep 13, 2012, at 20:40, James Sharrett jsharr...@tidemark.net wrote:
I'm trying to define a trigger function that looks for changes in table A
(table the trigger for the function is on) and write a delta record into
table B. So if a record has a value of 100 in table A, and it is updated
On Sep 22, 2012, at 20:15, JORGE MALDONADO jorgemal1...@gmail.com wrote:
I have the following query:
SELECT
sem_clave,
to_char(secc_esp_media.sem_fechareg,'TMMon-DD-') as sem_fechareg,
sem_seccion,
sem_titulo,
sem_enca,
tmd_nombre,
tmd_archivo,
tmd_origen,
gen_nombre,
On Sep 29, 2012, at 6:49, Matthias Nagel matthias.h.na...@gmail.com wrote:
Hello,
is there any way how one can store the result of a time-consuming calculation
if this result is needed more than once in an SQL update query? This solution
might be PostgreSQL specific and not standard SQL
On Sep 29, 2012, at 12:02, Andreas maps...@gmx.net wrote:
Hi,
asume I've got 2 tables
objects ( id int, name text )
attributes ( object_id int, value int )
attributes has a default entry with object_id = 0 and some other where
another value should be used.
e.g.
objects
( 1,
thank you. The WITH clause did the trick. I did not even know that such a
thing exists. But as it turns out it makes the statement more readable and
elegant but not faster.
The reason for the latter is that both the CTE and the UPDATE statement
have the same FROM ... WHERE ... part,
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On
Behalf Of Robert Buck
Sent: Monday, October 01, 2012 8:47 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] [noob] How to optimize this double pivot query?
I have two tables that contain key-value data that I want to
.
Are there other better options worth considering that you could point me
towards that supports storing metrics viz. with an unbounded number of metric
types in my case?
Bob
On Mon, Oct 1, 2012 at 9:07 PM, David Johnston pol...@yahoo.com wrote:
From: pgsql-sql-ow...@postgresql.org
-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 to
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of Fabio Ebner - Dna Solution
Sent: Thursday, October 04, 2012 3:41 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] String Search
Anyone know the best way to do one select in
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of air
Sent: Saturday, October 06, 2012 8:48 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] How to make this CTE also print rows with 0 as count?
I have a CTE based query, to
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of Victor Sterpu
Sent: Friday, October 19, 2012 2:15 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Trigger triggered from a foreign key
I have this trigger that works fine.
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of lmagnell
Sent: Friday, October 19, 2012 4:25 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Insert strings that contain colons into a table
How can I insert multiple
On Oct 26, 2012, at 5:24, Gary Stainburn gary.stainb...@ringways.co.uk wrote:
This is my best effort so far is below. My concern is that it isn't very
efficient and will slow down as record numbers increase
create view current_qualifications as
select q.*,
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
ow...@postgresql.org] On Behalf Of jan zimmek
Sent: Tuesday, October 30, 2012 7:45 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] replace text occurrences loaded from table
hello,
i am actually trying to
On Nov 26, 2012, at 7:13, Thomas Kellerer spam_ea...@gmx.net wrote:
So I tried:
SELECT *
FROM some_table
WHERE regexp_matches(somecol, 'foobar') is not null;
However that resulted in: ERROR: argument of WHERE must not return a set
Hmm, even though an array is not a set I can
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Wes James
Sent: Friday, December 21, 2012 11:32 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] deciding on one of multiple results returned
If a query returns, say the following results:
id value
0
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of JORGE MALDONADO
Sent: Saturday, December 29, 2012 2:06 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Query execution based on a condition
I have a query similar to the one shown below but, depending on
SELECT num_ads, sum(...), sum(...),
FROM ( your query here )
GROUP BY num_ads;
BTW, While SELECT '1' num_ads is valid syntax I recommend you use the
AS keyword. '1' AS num_ads
David J.
--
View this message in context:
My prior comment simply answers your question. You likely can rewrite your
query so that a separate grouping layer is not needed (or rather the group
by would exist in the main query and you minimize the case/sub-select column
queries and use aggregates and case instead).
David J.
--
View
JORGE MALDONADO wrote
How does the EXCEPT work? Do fields should be identical?
I need the difference to be on the first 3 fields.
Except operates over the entire tuple so yes all fields are evaluated and,
if they all match, the row from the left/upper query is excluded.
If you need something
Reply-all is acceptable; but standard list protocol is to respond at the end
of the message after performing quote editing.
JORGE MALDONADO wrote
Firstly, I want to thank you for responding.
Secondly, I wonder if I should only reply to the mailing list (I clicked
Reply All); if this is the
gmb wrote
The best, which you won't
like, is to wait for 9.4 where unnest() will most likely have a WITH
ORDINALITY option and you can sort on that.
The fact that this type of thing is on the 9.4 roadmap indicates (to me,
in any case) that there are problems with the UNNEST
Luca Vernini wrote
I'm writing a system with havy use of composite types.
I have a doubt.
I'm writing all in functions with language plpgsql.
When I read a field from a composite type I must write something like
this:
status = ((in_customer.customer_data).customer_status).status_id
And
Luca Vernini wrote
2013/7/8 David Johnston lt;
polobo@
gt;
This may be a pl/pgsql limitation but you should probably provide a
complete
self-contained example with your attempt so that user-error can be
eliminated.
David J.
All right. Here you are a complete example. Just tested
spulatkan wrote
so following is enough to get the rows that matches regular expression
This is bad form even if it works. If the only point of the expression is
to filter rows it should appear in the WHERE clause. The fact that
regexp_matches(...) behaves in this way at all is, IMO, a flaw
jonathansfl wrote
greetings. I'm trying to write a function that acts like a switchboard,
calling other functions depending on incoming parameters.
I'm getting error: query has no destination for result data
SELECT * FROM dev.pr_test_subfunction(SWV_Action);
In pl/pgsql if you do
jonathansfl wrote
SELECT * INTO v_outvar1, v_outvar2, v_outvar3 FROM
custom.pr_test_subfunction(SWV_Action);
OPEN swv_refcur for SELECT v_outvar1;
OPEN swv_refcur2 for SELECT v_outvar2;
OPEN swv_refcur3 for SELECT v_outvar3;
RETURN;
I've never used cursors in this way
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
JORGE MALDONADO wrote
I have a table with fields that I guess would be a good idea to set as
indexes because users may query it to get results ordered by different
criteria. For example:
--
Artists Table
--
1. art_id
2. art_name
3. art_bday
4. art_sex
JORGE MALDONADO wrote
I have search for information about the difference between unique index
and unique constraint in PostgreSQL without getting to a specific
answer,
so I kindly ask for an explanation that helps me clarify such concept.
A constraint says what valid data looks like.
An
JORGE MALDONADO wrote
If a table has a foreign key on 2 fields, should I also create an index
composed of such fields?
Yes.
If you want to truly/actually model a foreign key the system will require
you to create a unique constraint/index on the primary/one side of the
relationship.
CREATE
Steve Grey-2 wrote
Unique indexes can be partial, i.e. defined with a where clause (that must
be included in a query so that PostgreSQL knows to use that index) whereas
unique constraints cannot.
This implies there can be data in the table but not in the index and thus
said index is not part
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
songs)
*
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, foreign table
91 matches
Mail list logo