Re: existence of a savepoint?

2018-05-29 Thread Brian Dunavant
f target_point exists RELEASE =# rollback to target_point; <----- rollback to it ROLLBACK Cheers, -Brian Dunavant

Re: sql questions

2018-07-20 Thread Brian Dunavant
On Fri, Jul 20, 2018 at 4:27 AM wrote: > > b) can a sql function return the count of affected rows of some query? > create function merge_names(int, int) returns void as > $_$ > update namelinks set nid = $2 where nid = $1; > -- want the affected rows of the above query > delete from names where

Re: Making "invisible" characters visible ? (psql)

2019-11-20 Thread Brian Dunavant
On Wed, Nov 20, 2019 at 9:16 AM stan wrote: > > How can i make these "invisible" characters visible? > > > In psql, by default it displays nulls as nothing. You can specify what they should display as with: \pset null '' Chances are those are all nulls, and will now display as whatever you set

Re: performance of loading CSV data with COPY is 50 times faster than Perl::DBI

2020-01-31 Thread Brian Dunavant
You can use COPY over DBI. https://metacpan.org/pod/DBD::Pg#COPY-support On Fri, Jan 31, 2020 at 2:03 PM Pavel Stehule wrote: > > > pá 31. 1. 2020 v 19:25 odesílatel Matthias Apitz > napsal: > >> >> Hello, >> >> Since ages, we transfer data between different DBS (Informix, Sybase, >> Oracle, a

Re: Listen/Notify feedback

2020-07-11 Thread Brian Dunavant
One aspect is if there is no one listening when a notify happens, the message is lost (e.g. no durability). If this is important to you, it can be addressed by writing the messages to a table as well when you NOTIFY, and the listener deletes messages after they are processed. On connection the l

Re: Inserting many rows using "with"

2020-09-11 Thread Brian Dunavant
On Fri, Sep 11, 2020 at 1:31 PM Harmen wrote: > Hi all, > > Are there any known problems with this strategy? Are they any other > methods of > inserting lots of records in a nicer way? > I do this all the time with insert and it's wonderful. It can get tricky if you need to do UPDATEs. You can

Re: Is replacing transactions with CTE a good idea?

2021-04-01 Thread Brian Dunavant
On Thu, Apr 1, 2021 at 10:49 AM Glen Huang wrote: > If I decide to replace all my transaction code with CTE, will I shoot > myself in the foot down the road? > I do this all the time and makes code way cleaner. It's very straightforward with inserts queries. When you deal with updates/deletes

Re: Is replacing transactions with CTE a good idea?

2021-04-01 Thread Brian Dunavant
On Thu, Apr 1, 2021 at 11:06 AM Glen Huang wrote: > Care to expand why they are tricker? I presume they run the risk of being > referenced more than once? > There are lots of gotchas. It's also been a few years since I dug deep into this, so some of this may have changed in more recent versions.

Re: The tragedy of SQL

2021-09-14 Thread Brian Dunavant
On Tue, Sep 14, 2021 at 1:54 PM Raymond Brinzer wrote: > > So, the affection I have for SQL is due to it being a gateway to a > great idea; my frustration is that it's a bottleneck in getting to > that same idea. > > I have the opposite perspective. As a dev/manager, SQL is much more powerful at

Re: "two time periods with only an endpoint in common do not overlap" ???

2021-10-15 Thread Brian Dunavant
Think of it this way. When someone says they have a meeting from 1-2 and another from 2-3, do those meetings overlap? They do not, because we're actually saying the first meeting is from 1:00 through 1:59:59.9. The Postgres date ranges are the same way. The starting point is inclusive, bu