Kaleeswaran Velu v_kal...@yahoo.com wrote:
Hi Team,
I am using PostgreSQL 9.2.3 in Windows platform. I have created two databases
in it. Now I want to refer the tables across the databases. Meaning would like
to create Database link. Can anyone guide me on how to create a DB link?
You can
Sofer, Yuval yuval_so...@bmc.com wrote:
Hi,
I am using Postgres DB with stand by database, configured with streaming in
synchronized mode (each commit on primary DB waits for commit on secondary
DB).
Sometimes we suffer from network issues and as consequences, secondary
Andreas maps...@gmx.net hat am 17. Februar 2013 um 18:02 geschrieben:
Hi,
I need to store data that has a valid timespan with start and enddate.
objects ( id, name, ... )
object_data ( object_id referencs objects(id), startdate, enddate, ... )
nothing special, yet
How can I have PG
sorry, only a private replay and not to the list
-- Ursprüngliche Nachricht --
Von: Andreas Kretschmer andr...@a-kretschmer.de
An: Antonio Parrotta antonioparro...@gmail.com
Datum: 28. Dezember 2012 um 15:19
Betreff: Re: [SQL] sql basic question
Hi,
your question was: What I want
| 129007 | 0.63454675634756 |0 *m
19 | 129007 | 0.97897897897654 |0 *M
13 | 129007 | 0.22345364656788 |1 *m
11 | 129007 | 0.86787897897689 |1 *M
thanks
- Antonio
On 28 December 2012 15:19, Andreas Kretschmer andr...@a-kretschmer.dewrote:
Hi,
your
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
Anton Gavazuk antongava...@gmail.com wrote:
Hi dear community,
Have probably quite simple task but cannot find the solution,
Imagine the table A with 2 columns start and end, data type is date
start end
01 dec. 10 dec
11 dec. 13 dec
17 dec. 19 dec
.
If I
Andreas Kretschmer akretsch...@spamfence.net wrote:
Anton Gavazuk antongava...@gmail.com wrote:
Hi dear community,
Have probably quite simple task but cannot find the solution,
Imagine the table A with 2 columns start and end, data type is date
start end
01 dec
Matthias Nagel matthias.h.na...@gmail.com hat am 29. September 2012 um 12:49
geschrieben:
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
amit sehas cu...@yahoo.com wrote:
In SQL, given a table T, with two fields f1, f2,
is it possible to create an index such that the same record is indexed
in the index, once with field f1 and once with field f2. (I am not
looking for a compound index in which the key would look like f1,
Tom Lane t...@sss.pgh.pa.us wrote:
Wayne Cuddy lists-pg...@useunix.net writes:
A less bogus way of doing things is to use an EXCLUDE constraint,
although that will restrict you to be running PG 9.0 or newer. You
also need some way of representing the ranges as indexable objects.
In 9.0 or
Andreas maps...@gmx.net wrote:
Hi,
I've got a log-table that records events regarding other objects.
Those events have a state that shows the progress of further work on
this event.
They can be open, accepted or rejected.
I don't want to be able to insert addition events regarding an
Andreas Kretschmer akretsch...@spamfence.net wrote:
Andreas maps...@gmx.net wrote:
Hi,
I've got a log-table that records events regarding other objects.
Those events have a state that shows the progress of further work on
this event.
They can be open, accepted or rejected.
I
Marc Mamin m.ma...@intershop.de wrote:
Or this one:
test=*# create unique index on log((case when state = 0 then 0 when
state = 1 then 1 else null end));
CREATE INDEX
Now you can insert one '0' and one '1' - value - but no more.
Hi,
A partial index would do the same,
Andreas maps...@gmx.net wrote:
Hi,
is there a way to limit access for some users only to certain records?
e.g. there is a customer table and there are account-managers.
Could I limit account-manager #1 so that he only can access customers
only acording to a flag?
Yea, it's possible.
Jan Bakuwel jan.baku...@greenpeace.org hat am 21. Mai 2012 um 01:17
geschrieben:
Hi,
I'm trying to get my head around the following question. As an example
take a table with products:
productid (pk)
name
and productprice
productpriceid (pk)
productid (fk)
pricedate
price
There
Marcel Ruff m...@marcelruff.info hat am 4. Mai 2012 um 12:25 geschrieben:
Hi,
is an alias name not usable in the where clause?
Exactly.
Andreas
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
Emi Lu em...@encs.concordia.ca wrote:
Good morning,
May I know is there a simple sql command which could return missing
numbers please?
For example,
t1(id integer)
values= 1, 2, 3 500
select miss_num(id)
from t1 ;
something like
,[ code ]
| test=# select * from
Raj Mathur (राज माथुर) r...@linux-delhi.org wrote:
Nice one, but curious about how would this perform if the numbers in
question extended into 7 figures or more?
mode=David Fetter
TIAS
(Try It And See)
/mode
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a
John Fabiani jo...@jfcomputer.com 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 using plsql.
Since you can login to an remote database server: no.
Andreas
--
Really, I'm not out
John Fabiani jo...@jfcomputer.com 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 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
rverghese ri...@hotmail.com wrote:
I want to insert a bunch of records and not do anything if the record already
exists. So the 2 options I considered are 1) check if row exists or insert
and 2) ignore the unique violation on insert if row exists.
Any opinions on whether it is faster to
vinodh chowdary vinodchowda...@gmail.com wrote:
Hi sir,
i am using postgres as database for my project.
i want to convert postgres data into excel sheet.
is there any way to do it?
please reply me.
This should be possible with ODBC.
(But i'm not familiar with it, don't ask me how ...)
Gabriel Filipiak gabriel.filip...@gmail.com wrote:
Hi,
so I am working on PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2, 64-bit.
It seems that i can't give a table name for example testTable it has to be
test_table, because I can't
Stefan Weiss krewech...@gmail.com wrote:
- running this query -
SELECT name
FROM dossier_contact_v
WHERE dossier_id = 56993
AND ctype = 234
UNION
SELECT name
FROM dossier_contact_v
WHERE dossier_id = -1
AND ctype = -1
ORDER BY
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 primary key
Richard Klingler rich...@klingler.net wrote:
This seems to do the trick...
select arp.ip, arp.mac, arp.port2time, arp.time, arp.hostname, arp.vlan
from arp, port, node
where
arp.arp2port = port.portid and port.name = 'Fa1/0/1'
and port.port2node = node.nodeid
and
Jan Peters peters...@gmx.at wrote:
Dear all,
maybe a stupid question, but: I have a table that is ordered like this:
user_id|timestamp|event
1 |0:1 |event_a
1 |0:2 |event_b
2 |0:1 |event_b
2 |0:3 |event_c
2 |0:4 |event_b
3 |0:1
You can't do that in THAT way, but you can use dynamic SQL:
test=# select * from drop_role ;
t
foobar
(1 row)
test=*# do $$ declare r text; begin for r in select t from drop_role loop
execute 'drop role ' || quote_ident(r) || ';'; end loop; end; $$language
plpgsql;
DO
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.
maya.more meena...@gmail.com wrote:
I have a table with Date and unit column. . I want to find sum of unit column
considering 3 days each
User will specify start and enddate
Eg
DateUnit
10/1/2011 1
10/2/2011 2
10/3/2011 3
10/4/2011 4
10/5/2011 4
Andreas maps...@gmx.net wrote:
Hi,
is there a clever way to check overlapping time intervals ?
An option named n should be taken from date y to y.
The same name is ok for another interval.
e.g. table : mytab ( d1 date, d2 date, n text, v text )
There should be a constraint to provide no
, and Andreas Kretschmer. You guys are
great.
And even better, in the first comment to the blog post, I was advised about
the
SETVAL() function which does exactly what I wanted in the first place.
Yeah, right!
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
into m max(i) from foo; execute
'create sequence seq_foo start with ' || m; end; $$;
DO
Time: 1,115 ms
test=*# \ds seq_foo;
List of relations
Schema | Name | Type | Owner
+-+--+
public | seq_foo | sequence | kretschmer
(1 row)
test=*# select
Emi Lu em...@encs.concordia.ca wrote:
Thank you for the info.
I found a simple way:
==
[1] create SEQUENCE tmp start 7820;
[2]
insert into desti_table_name
select nextval('tmp'),
c1, c2... ... cN
from t1 left join t2... ... tn
where
Tony Capobianco tcapobia...@prospectiv.com wrote:
Here's my table:
plsql_dw=# \d tmpsv_parent_master
Table staging.tmpsv_parent_master
Why won't this work?
plsql_dw=# select memberid || addeddate from tmpsv_parent_master limit
10;
ERROR: operator does not exist: numeric ||
Emi Lu em...@encs.concordia.ca wrote:
Hello,
Is there a way to force the view column change from varhcar(32) to
varchar(128)?
No, you have to recreate the view ...
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.
John Lister john.lister...@kickstone.com wrote:
Hi, I was wondering if it is possible to do this with a single query rather
than iterate over all of the rows in an application:
I have a table which for brevity looks like:
create table offers {
integer id;
integer product_id;
Edward W. Rouse ero...@comsquared.com wrote:
Is there any way to remove a duplicate row from a table? Not my db but I have
to work with it. On version 7.4 right now.
How to select the right records?
You can try to use the ctid-column, see my simple example:
test=# select * from dups ;
i
In response to Edward W. Rouse :
Solved. Because this is a 7.4 version and we used with oids by default, I
can use the oids instead of the ctid to remove the duplicates.
Yeah, that's right ;-)
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr
see, the where-condition contains a timestamp that isn't in the
table, it's after the id=3.
Maybe there are other, better solutions...
HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D
, checking if the 2nd
column is different from the previous.
With plain SQL it's maybe possible too, but i don't know how ...
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172
In response to Trinath Somanchi :
Hi All,
I have a column in my Postgresql database tables which need UUID.
Is there any function in Pgsql for UUID generation. Please help me in this
regard.
http://www.postgresql.org/docs/8.4/static/uuid-ossp.html
Andreas
--
Andreas Kretschmer
Kontakt
In response to venkat :
Dear All,
How to get Column Names from Table in PostgreSQL.
select column_name from information_schema.columns where table_name =
'your_table';
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG
to configure your editor not to
save the BOM or chop off the first three bytes yourself
(with tail, sed, Perl Co.).
Additional error: you can't do a COMMIT inside a function.
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99
John jo...@jfcomputer.com 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
link.
My link-collection: http://delicious.com/akretschmer/windowing and
by page_count_pdate;
ERROR: aggregate function calls cannot be nested
LINE 3: MAX(page_count_count) as day_max, sum(MAX(page_count_cou...
Can you provide the correct table definition?
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99
a simple AFTER trigger instead.
There are a ready solution:
http://andreas.scherbaum.la/blog/archives/100-Log-Table-Changes-in-PostgreSQL-with-tablelog.html
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326
additional contrib module from Jeff Davis,
described here:
http://thoughts.j-davis.com/2010/03/09/temporal-postgresql-roadmap/
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2
In response to A. Kretschmer :
please, suggest an idea how to implement this in SQL without writing a
procedure.
There are a really nice additional contrib module from Jeff Davis,
described here:
http://thoughts.j-davis.com/2010/03/09/temporal-postgresql-roadmap/
short example
| 8
10 |13
(3 rows)
Maybe that's the way you have to go ...
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing
between 8.1 and 8.4 ...
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription
1
2
3
(3 Zeilen)
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your
Cliff Wells cl...@develix.com wrote:
As far as I can see, INSERT INTO...RETURNING is semantically equivalent
to SELECT...FROM with a side-effect, so it seems this construct should
work. Can someone shed some light?
Well, at the moment you can't reuse the RETURNING-values, you have to
wait
PostgreSQL 8.4.2 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.3.real
(Debian 4.3.2-1.1) 4.3.2, 64-bit
(1 row)
test=*#
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150
| count
+-+---
1 | 3 | 1
2 | 2 | 2
3 | 1 | 3
(3 rows)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql
by id_price,created_on ;
id_price | price | created_on
--+---+-
1 |12 | 2010-02-01 00:00:00
1 | 8 | 2010-03-01 00:00:00
(2 rows)
That's okay for you?
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639
In response to Louis-David Mitterrand :
On Wed, Mar 24, 2010 at 03:29:36PM +0100, A. Kretschmer wrote:
In response to Louis-David Mitterrand :
Hi,
I have time series data: price(id_price int, price int, created_on
timestamp)
I'd like to select the latest price before, say
A. Kretschmer andreas.kretsch...@schollglas.com wrote:
Well, and now i'm using 8.4 windowing-functions:
test=*# select * from price order by price_id, d;
price_id | price | d
--+---+
1 |10 | 2010-03-12
1 |11 | 2010-03-19
1 |12
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref
things.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http
thing, to_char() should be the
solution. For instance:
test=# select to_char(now(), '-MM-DDThh:mm TZ');
to_char
--
2010-03-17T08:03 CET
If this isn't correct, please show an example for the correct format,
okay?
Regards, Andreas
--
Andreas Kretschmer
Kontakt
Gianvito Pio pio.gianv...@gmail.com wrote:
Hi all,
is there a way to drop all constraints of a table?
I found this workaround in the manual:
CREATE TABLE temp AS SELECT * FROM distributors;
DROP TABLE distributors;
CREATE TABLE distributors AS SELECT * FROM temp;
DROP TABLE temp;
I
Gianvito Pio pio.gianv...@gmail.com wrote:
Hi all,
is there a way (also strange) to define a trigger on a system table (for
example on pg_class)?
No.
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.
In response to silly sad :
my own wild guess:
string constant '*' is of type unknown
Maybe. Add a explicit cast, for instance '*'::text
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D
Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
=*# select array_agg(a.id), v from a join b on (b.id in (select a.id from
a)) group by a.v;
array_agg | v
---+---
{1,2,3,4,1,2,3,4} | 1
{6,5,5,6} | 2
(2 rows)
Question: you are 'pif' in the irc-channel?
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz
when modified =
'2010-01-01' then model else null end as count3 from inventory) foo ;
count | count | count
---+---+---
2 | 2 | 4
(1 row)
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4
8q5tmky...@sneakemail.com 8q5tmky...@sneakemail.com wrote:
Hi,
I have a two tables:
article
articleID, name, content
tags
articleID, tag
I want to find all articles that are tagged with a but not b
how do I do this?
select a.* from article left join tags t on
that, use
coalesce(column,'') to change NULL to ''.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make
(primary key) and
a column for the sum of qty. And you need a TRIGGER: update this table
for every insert, update and delete on your table t.
Now you can ask _this_ new table if the sum(qty) your constant, this
should work very fast.
Just an idea...
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz
msi77 ms...@yandex.ru wrote:
Does PG support CTE?
Since 8.4 yes.
You can try it.
Sorry, but i don't know how a CTE can help in this case, can you explain
that?
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.
/pageinspect: No such file or
directory
SQL state :58P01
Pageinspect is a contrib-modul, so i think, you should install that. But
i don't know if this available for 8.2.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4
that function
later...
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription
system ?
Set log_min_duration to a propper value and analyse your slow queries.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
--
Sent via pgsql-sql mailing list (pgsql-sql
Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
rows.
Maybe i don't understand you, can you show a simple example with data?
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http
In response to Andreas :
A. Kretschmer schrieb:
[...] Or simpler:
test=*# select ((d-'2009-10-02'::date)/14) || '. period' as period,
sum(value) from foo group by 1;
This is tricky, because you use a text-column to sort but need numerical
sorting since there will be more than 0-9
) group by m.id, s.id;
id | id | sum
++-
1 | 1 | 6
(1 row)
test=*# select m.id, s.id, sum(s.value) from master m left join slave s on
(m.id=s.id) group by m.id, s.id;
id | id | sum
++-
1 | 1 | 6
2 ||
(2 rows)
Andreas
--
Andreas Kretschmer
Kontakt
(4 rows)
test=*# select distinct on (id_product) id_product, price from price order by
id_product, datum desc;
id_product | price
+---
1 |12
2 | 8
(2 rows)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr
slave AS s ON (m.id = s.master_id) GROUP BY m.id
) foo order by 1,2
) bar group by 1;
id | array_agg
+---
1 | {3,5,7}
2 | {NULL}
(2 rows)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
--
Sent via pgsql-sql mailing list
| {3,5,7}
2 | {NULL}
(2 rows)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
nextval() for this sequence.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription
:
CREATE OR REPLACE FUNCTION unnest(ANYARRAY) RETURNS SETOF ANYELEMENT
LANGUAGE SQL AS $$SELECT $1[i] FROM
generate_series(array_lower($1,1),array_upper($1,1)) i;$$;
(with Thx to David Fetter)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID
;
end;
The variable sql contains the whole query, and then execute that.
HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-sql mailing list (pgsql-sql
by
field1, field2;
field1 | field2 | field3
++
x1 | y1 | 5
x1 | y3 | 4
x2 | y1 | 2
x2 | y3 | 4
(4 rows)
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID
In response to Premila Devi :
Dear All,
I like to import (.CVS File) to postgreSql.Could anyone help me. May I know,
what the requirement.
You can use the COPY-command for that, see the doc.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr
show/explain, which rows in your example contains now the values
for the new row?
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-sql mailing list
| 2102
5 | 2009-03-01 | 2009-03-01 | 2103 | 2103
(3 rows)
Hope that helps...
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-sql mailing
Emi Lu em...@encs.concordia.ca wrote:
Good morning,
I have a currency table (code, description).
Example values:
ADF | Andorran Franc
... ...
ANG | NL Antillian Guilder
AON | Angolan New Kwanza
AUD | Australian Dollar
AWG | Aruban Florin
BBD | Barbados Dollar
USD | US Dollar
Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
In response to A. Kretschmer :
test=*# select foo.user_name, foo.log_type, sum(case when log_type_fk is
not null then 1 else 0 end) from (select user_id, user_name,
log_type_id, log_type from users cross join log_type) foo full join log
on ((foo.user_id, foo.log_type_id)=(log.user_fk
'));
CREATE INDEX
test=*# insert into bobtest (a, b) values (1, 4);
INSERT 0 1
test=*# insert into bobtest (a, b, c) values (1, 4, NULL);
ERROR: duplicate key value violates unique constraint idx_bobtest
test=!#
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639
In response to Robert Edwards :
A. Kretschmer wrote:
In response to Robert Edwards :
Can anyone suggest a way that I can impose uniqueness on a and b when
c is NULL?
Sure, use a functional index:
test=# create table bobtest (a int, b int, c int);
CREATE TABLE
test=*# create unique
In response to Leo Mannhart :
On Mon, 2009-06-29 at 17:08 +1000, Robert Edwards wrote:
A. Kretschmer wrote:
In response to Robert Edwards :
Can anyone suggest a way that I can impose uniqueness on a and b when
c is NULL?
Sure, use a functional index:
test=# create table
bla
CREATE TABLE
test=*# rollback;
ROLLBACK
test=# set client_min_messages='warning';
SET
test=*# create table bla(id int primary key);
CREATE TABLE
test=*#
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA
you. Other solution: write a function in plpgsql and
build a string that contains your query, and EXECUTE that string.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent
, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref
1 - 100 of 407 matches
Mail list logo