John Fabiani wrote:
> Yes I understand - but I want to know is it possible? Can I read the data I
> just inserted without a commit.
> [...]
Are you talking about a web application? Then no, you'll
have to code that yourself.
Tim
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
(anonymous) wrote:
> is there a way to split up phone numbers?
> I know that's a tricky topic and it depends on the national
> phone number format.
> I'm especially interested in a solution for Germany, Swizerland and Austria.
> I've got everything in a phone number column that makes hardly sense
"Edward W. Rouse" wrote:
> Hehe, thanks, I played around and ended up with this:
> round(SUM(extract('epoch' from (time_out - time_in
> I will have to do the division outside of the query, but that's really a
> minor issue.
You can always use subqueries.
> Knowing the total i
I wrote:
> I frequently use pg_dump to dump databases and compare them
> with diff. To get rid of most "false positives", I'd like
> to patch pg_dump to sort the table so that its dumped order
> isn't changed more than necessary by insertions & Co.
> So I'm looking for a query that will return
Tom Lane wrote:
>> [ "0x13" is lexed as "0" then "x13" ]
>> Is this behaviour really conforming to the standard?
> Well, it's pretty much the universal behavior of flex-based lexers,
> anyway. A token ends when the next character can no longer sensibly
> be added to it.
I know, but - off the
Hi,
I just tried to input a hexadecimal number in PostgreSQL
(8.4) and was rather surprised by the result:
| tim=# SELECT 0x13;
| x13
| -
|0
| (1 Zeile)
| tim=# SELECT 0abc;
| abc
| -
|0
| (1 Zeile)
| tim=#
The documentation says:
| A token can be a key word, an identifier,
Alvaro Herrera wrote:
>> would someone with the appropriate authority please unsubscribe this
>> person's email address from this list so we don't all get a bounce message
>> after every email we send to the list? Thanks.
> Just did it. In the future, please email sysadm...@postgresql.org with
MaurĂcio Cruz wrote:
> I'm trying to use lo_import to import a file into my
> database, if I execute from postgres runing in my local
> machine
> it works perfectly, but if I do it in the postgres runing in
> the server, it says "No such file or directory"
> I Guess postgres only see file on the
Hi,
I frequently use pg_dump to dump databases and compare them
with diff. To get rid of most "false positives", I'd like
to patch pg_dump to sort the table so that its dumped order
isn't changed more than necessary by insertions & Co.
So I'm looking for a query that will return a list of a
ta
Harald Fuchs 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.
(anonymous) wrote:
> How could I calculate differences of timestamps in a log-table?
> Table log ( user_id integer, login boolean, ts timestamp )
> So login = true would be a login-event and login = false a logout.
> Is there a way to find the matching login/logout to
> calculate the difference?
Leif Biberg Kristensen wrote:
> On Saturday 17. September 2011 19.07.03 Tim Landscheidt wrote:
>> Leif Biberg Kristensen wrote:
>> > UPDATE sources SET source_text = regexp_replace(source_text,
>> > E'n="(.*?)$1(.*?)"', E'n="\\1$2\\2&
Leif Biberg Kristensen wrote:
>> UPDATE sources SET source_text = regexp_replace(source_text,
>> E'n="(.*?)$1(.*?)"', E'n="\\1$2\\2"', 'g') where source_text like
>> '%n="%$2%">%';
> Sorry, I pasted a literal replacement, and substituted the parameters by hand.
> The expression should of course
Dianna Harter wrote:
> Having trouble getting a window function to sort correctly.
> Given this data
> consumer_id | move_date | history_timestamp
> -++
>12345| 2008-01-05 | 2007-12-11 06:02:26.842171
>12345| 2008-02-29 |
(anonymous) wrote:
> 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.
Try:
| SELECT firs
(anonymous) wrote:
> there is a table that has among others a integer primary key
> "id" and another integer column "prio" as well as an integer
> "group_id".
> I'd like to invert the values of the prio-column for one of the groups.
> The prio numbers start with 3 and there are 1159 different
> p
(anonymous) wrote:
> [...]
> I intend pass the number of the month(say 1 for January , 2 for February
> etc>) as the parameter to this method and return a number that corresponds
> to the index of the month in the new order , say I pass 8 for August , I
> return 11 , in order to get the index of
Johann Spies 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:
> '|0894396e-16bf-4e63-aa52-97fe7031e
(anonymous) wrote:
> how can I remove a set of characters in text-columns ?
> Say I'd like to remove { } ( ) ' " , ; . : !
> Of course I can chain replace ( replace ( replace ( replace
> ( ... , '' ) and replace the chars one by one against
> an empty string ''.
> There might be a more elega
Gary Chambers wrote:
> I've been provided a CSV file of parts that contains duplicates of
> properties (e.g. resistors have a wattage, tolerance, and temperature
> coefficient property) of those parts that differ by a manufacturer
> part number. What I'd like to do is to process this file and, u
Wes Devauld wrote:
> I believe I lost the flavour of what I'm doing when I constructed this
> example. I'm not interested in the timepoint as much as the value that is
> attached to it. I need to be able to find the last chronological record for
> a given day.
> I can get the value for which I
Rainer Stengele wrote:
> yes, the date is always incremented - but anyway the date
> column is not really the point! Actually the first tow
> columns are relevant. I want them gouped together as
> indicated, adding up column 1 in the blocks with identical
> second column, but not adding up over a
Richard Huxton wrote:
>>> What I want to get is the values grouped by "subset", where a subset is a
>>> set of rows with identical column until the colum changes.
>>> Is there a way to get
>>> | 2 | B |
>>> | 4 | C |
>>> | 4 | B |
>>> | 3 | D |
>>> by SQL only?
>> I think, the problem is that
(anonymous) wrote:
> is there a way to find events in a log that happen within a
> certain timespan to each other?
> Log is like this
> event_idinteger not null default 0 primary key
> event_type_idinteger not null default
> user_idinteger not null default
Jerrel Kemper wrote:
> My table consist off the following fields
> CREATE TABLE test
> (
> id bigserial NOT NULL,
> name character varying(100),
>CONSTRAINT logs_pkey PRIMARY KEY (log_id)
> )
> with value :
> IDName
> 1 001
> 201
> 3 1
> 411
> Select
Andrew Geery wrote:
> [...]
> My questions are:
> (A) Is there a way to check (2) above using a constraint and not a trigger?
> (B) Is there an easier way to solve this problem? Does the complicated
> nature of the solution make the design poor?
> (C) Should I not worry about this constraint at
Steven Dahlin wrote:
> I am attempting to generate a temporary function to execute some dml with
> the following script:
> create or replace function setuplicense() returns integer as $$
> declare
> hwcustid integer := 0;
> retvalinteger := 0;
> begin
> insert into license.customer
>
Richard Broersma wrote:
>>> 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
John wrote:
> 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
>
Jasen Betts wrote:
>> It looks like most of our tools are using the Perl version of regular
>> expressions with an upper limit of a bound being 32766. Is there any way to
>> change this in PG? Or can I change from POSIX to Perl?
> perhaps you can do something in pl-perl?
> posix regular expre
Michele Petrazzo - Unipex wrote:
> I have two table that are so represented:
> t1:
> id int primary key
> ... other
> t2:
> id int primary key
> t1id int fk(t1.id)
> somedate date
> ... other
> data t1:
> 1 | abcde
> 2 | fghi
> data t2:
> 1 | 1 | 2010-05-23
> 2 | 1 | 2010-05-24
> 3 | 1 | 2010-
Louis-David Mitterrand wrote:
>> > you use something simple like (untested):
>> >
>> > | UPDATE cabin_type
>> > | SET id_cabin_type =
>> > | CASE
>> > | WHEN id_cabin_type = id1 THEN
>> > | id2
>> > | ELSE
>> > | id1
>> > | END
>> > | WHERE id_cabin_type IN
Louis-David Mitterrand wrote:
> I have this function which swaps primary keys for cabin_types (so that
> id_cabin_type ordering reflects natural data ordering):
> CREATE OR REPLACE FUNCTION swap_cabin_types(id1 integer, id2 integer)
> RETURNS integer
> AS $$
> declare
Brian Modra wrote:
>>> It works using 'now' and I assume that since curtime is
>>> of type DATE that the assignment casts the return automatically
>>> to type DATE. Thank you for the ideas.
>>> [...]
>> What's wrong with Pavel's correct and to-the-point answer?
> No need actually to cast... jus
Kenneth Marshall wrote:
> It works using 'now' and I assume that since curtime is
> of type DATE that the assignment casts the return automatically
> to type DATE. Thank you for the ideas.
> [...]
What's wrong with Pavel's correct and to-the-point answer?
Tim
--
Sent via pgsql-sql mailing li
Mark Fenbers wrote:
> I am using psql's \copy command to add records to a database
> from a file. The file has over 100,000 lines.
> Occasionally, there is a duplicate, and the import ceases
> and an internal rollback is performed. In other words, no
> data is imported even if the first error o
Leif Biberg Kristensen wrote:
> [...]
> So far, so good. But when I try to do the actual expansion, I'm stumped.
> pgslekt=> select regexp_replace((select source_text from sources where
> source_id=23091), (select quote_literal(short_link) from short_links where
> link_type = 'sk'), (select quot
Feixiong Li wrote:
> I am newbie for sql, I have a problem when using max()
> function, I need get null when there are null in the value
> list, or return the largest value as usual, who can do
> this?
> i.e. max([1,2,3,4,5]) => 5
> max([1,2,3,4,5,null]) => null
You can cheat a bit:
| tim=#
Louis-David Mitterrand wrote:
> Here is the basic schema:
> -->id_ship>---
> ||
> [SHIP]->id_ship->[CABIN]->id_cabin->[PRICE]<-id_cruise<-[CRUISE]
> It's a database of cruise prices.
> Each
Shruthi A wrote:
> Thanks people, but the trigger doesnt really solve my problem. You see,
> there is actually a CHAIN of dependencies where B references A, C references
> B, D and E reference C and so on... So if i start writing triggers for all
> these, there'll be a huge process to follow.
Shruthi A wrote:
> I have 2 tables (A and B) where the table B has a foreign key reference to
> table A. Like this:
> create table A (x int primary key);
> create table B (y int primary key, z int references A (x) );
> As you can see, i've not specified any further 'on delete' clause to the
>
Louis-David Mitterrand wrote:
> Here is my schema:
> cruise_line -> ship(id_line) -> cruise_type(id_ship) -> cruise(id_cruise_type)
> -> price(id_cruise, id_currency) <- currency (USD,GBP,EUR,CAD)
> (a 'cruise' is a 'cruise_type' + a date)
> I am trying to display a count of cruise's for
Michael Gould wrote:
> 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
> ('it''s crazy! i couldn''t believe kate mcdonald, leo dicaprio, (terrence)
> trent d''arby (circa the 80''s), and jada
Brian Sherwood wrote:
> I am looking to play around with the postgres XML functions, but can't
> seem to find a way to load my data.
> I have a number of XML files: file1.xml, file2.xml, etc All files
> follow the same xml format (DTD?)
> I would like to create the following table:
> CREA
Thom Brown wrote:
> [...]
> Having a look around, it looks as if Postgres might be misbehaving.
> According to this page,
> http://my.safaribooksonline.com/0596004818/sqlnut2-CHP-4-SECT-3, the ORDER
> BY in the window function's clause shouldn't be having this ordering effect:
> "Furthermore, t
Jan Verheyden wrote:
> Thanks for the suggestion, the only problem is, if primary key is used then
> each row should be unique what is not true; since I have a column
> 'registered' what only can be 1 or 0...
> [...]
I have no idea what you are trying to say.
Tim
--
Sent via pgsql-sql mail
"Relyea, Mike" wrote:
>> The goal is, where uid not equals to 'janvleuven10' a new
>> record should be inserted with the uid, and registered=0
> So if a record is found you want to update it and if a record isn't
> found you want to insert it. I think you'll probably want to use
> plpgsql http:
Alvaro Herrera wrote:
>> > It's on Windows
>> I'd go with notify and a listener written in C using c-client to send
>> emails, but only because I've used those before.
> I wouldn't write it in C but rather Perl or Python, but whatever suits
> your fancy should work (Visual Basic anyone?). The
(anonymous) wrote:
>> > Any ideas on how to achieve this? I would like to let the original sql
>> > code stay original. I can prepare postgres before executing the sql if
>> > this makes it easier to acheive the goal
>> Have a look at CREATE RULE.
> Ok, you mean I could create a rule for the tab
(anonymous) wrote:
> I have a problem where I want to tweak a simple select in an
> "unobtrusive way". Imagine I have the following select statement:
> "SELECT name FROM customer LIMIT 1" and I get a normal result set from
> this. But, could I,maybe by defining some other function or similar,
> ch
Hi,
I'm trying to check whether a given string is part of an
XPath result set. I have encountered some performance prob-
lems in the process, but before I track those down further,
I'd like to see if I've chosen the right path to begin with:
| SELECT * FROM $TABLE
| WHERE $COLUMN = ANY((xpath($
51 matches
Mail list logo