Hi,
I was wondering if PGSQL has a function similar to binary_checksum () of
MS SQL Server 2000. It is pretty handy when it comes to compare rows of
data instead of having to write long boolean expressions.
binary_checksum () takes a list of fields and it returns an integer value
which sumarize the row content.
Thanks,
Fed
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster 13 8682
> I was wondering if PGSQL has a function similar to binary_checksum () of MS SQL Server 2000. It is pretty handy when it comes to compare rows of data instead of having to write long boolean expressions. binary_checksum () takes a list of fields and it returns an integer value which sumarize the row content.
On a similar note, I've found myself wanting an extended '=' operator
meaning
(a = b or (a is null and b is null))
same goal of course, for more general comparisons...
d.
--
David Helgason,
Business Development et al.,
Over the Edge I/S ( http://otee.dk)
Direct line +45 2620 0663
Main line +45 3264 5049
On 26. sep 2004, at 19:58, Federico Balbi wrote:
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly
David Helgason wrote: I was wondering if PGSQL has a function similar to binary_checksum () of MS SQL Server 2000. It is pretty handy when it comes to compare rows of data instead of having to write long boolean expressions. binary_checksum () takes a list of fields and it returns an integer value which sumarize the row content.
You could use the md5 function.... such as :
select md5(foo) from bar where baz = 2;
J
On a similar note, I've found myself wanting an extended '=' operator meaning (a = b or (a is null and b is null))
same goal of course, for more general comparisons...
d.
--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandpromp t.com - http://www.commandprompt.com
PostgreSQL Replicator -- production quality replication for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org
> David Helgason wrote: I was wondering if PGSQL has a function similar to binary_checksum () of MS SQL Server 2000. It is pretty handy when it comes to compare rows of data instead of having to write long boolean expressions. binary_checksum () takes a list of fields and it returns an integer value which sumarize the row content.
You could use the md5 function.... such as :
select md5(foo) from bar where baz = 2;
Looks like md5() takes only a string. I need to pass alist of fields
instead. I was looking at the documentattion and I think I can write
soemthing like:
field1, field2, ..., fieldn = expr1, expr2, ..., exprn
This way one operator will check all the fields for equality.
Fed
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings You could use the md5 function.... such as :
select md5(foo) from bar where baz = 2;
Looks like md5() takes only a string. I need to pass alist of fields instead. I was looking at the documentattion and I think I can write soemthing like:
field1, field2, ..., fieldn = expr1, expr2, ..., exprn
This way one operator will check all the fields for equality.
Maybe I am missing what you are saying, but you can md5() the data
column... So you could do:
select one,two from foo where md5(one) = 'e4da3b7fbbce23 45d7772b0674a31 8d5';
or
select one,two from foo where md5(one) = $1; or whatever.
for example....
Sincerely,
Joshua D. Drake
Fed
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandpromp t.com - http://www.commandprompt.com
PostgreSQL Replicator -- production quality replication for PostgreSQL
On Sun, 26 Sep 2004 20:16:52 +0200, David Helgason <da***@uti.is > wrote: I was wondering if PGSQL has a function similar to binary_checksum () of MS SQL Server 2000. It is pretty handy when it comes to compare rows of data instead of having to write long boolean expressions. binary_checksum () takes a list of fields and it returns an integer value which sumarize the row content.
As noted, you can use the md5(text) function with the || (concat) operator
On a similar note, I've found myself wanting an extended '=' operator meaning (a = b or (a is null and b is null))
Setting 'transform_null _equals' to true in postgresql.conf should do
what you want.
--miker
same goal of course, for more general comparisons...
d. -- David Helgason, Business Development et al., Over the Edge I/S (http://otee.dk) Direct line +45 2620 0663 Main line +45 3264 5049 On 26. sep 2004, at 19:58, Federico Balbi wrote:
---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to ma*******@postg resql.org so that your message can get through to the mailing list cleanly
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
On Mon, 27 Sep 2004, Mike Rylander wrote: On Sun, 26 Sep 2004 20:16:52 +0200, David Helgason <da***@uti.is > wrote: On a similar note, I've found myself wanting an extended '=' operator meaning (a = b or (a is null and b is null))
Setting 'transform_null _equals' to true in postgresql.conf should do what you want.
Unfortunately, it probably won't. That only changes the explicit token
sequence = NULL into an IS NULL, it won't help if you're doing a=b where a
or b may be NULL.
The original does appear to be equivalent to "not(a is distinct from b)",
although I'm not sure that's necessarily easier to use than the above.
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives? http://archives.postgresql.org
Stephan Szabo <ss****@megazon e.bigpanda.com> writes: On Sun, 26 Sep 2004 20:16:52 +0200, David Helgason <da***@uti.is > wrote:
On a similar note, I've found myself wanting an extended '=' operator meaning (a = b or (a is null and b is null))
The original does appear to be equivalent to "not(a is distinct from b)", although I'm not sure that's necessarily easier to use than the above.
I often do things like "coalesce(a ,0) = coalesce(b,0)".
(Or whatever value you know won't appear)
Though for pretty small values of "often". It always makes me think twice
about my data model when I find myself doing this. But there are definitely
still cases where it's useful and as clean as anything else I could think of.
--
greg
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Even simpler: COALESCE( a = b, a IS NULL AND b IS NULL )
-- Dean
Greg Stark wrote on 2004-09-27 08:17: Stephan Szabo <ss****@megazon e.bigpanda.com> writes:
On Sun, 26 Sep 2004 20:16:52 +0200, David Helgason <da***@uti.is > wrote:
> On a similar note, I've found myself wanting an extended '=' operator > meaning > (a = b or (a is null and b is null))
The original does appear to be equivalent to "not(a is distinct from b)", although I'm not sure that's necessarily easier to use than the above.
I often do things like "coalesce(a ,0) = coalesce(b,0)". (Or whatever value you know won't appear)
Though for pretty small values of "often". It always makes me think twice about my data model when I find myself doing this. But there are definitely still cases where it's useful and as clean as anything else I could think of.
-- greg
---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org
On 27. sep 2004, at 22:08, Dean Gibson (DB Administrator) wrote: Greg Stark wrote on 2004-09-27 08:17: Stephan Szabo <ss****@megazon e.bigpanda.com> writes: >> On Sun, 26 Sep 2004 20:16:52 +0200, David Helgason <da***@uti.is > wrote: >>> On a similar note, I've found myself wanting an extended '=' operator >>> meaning >>> (a = b or (a is null and b is null)) > > The original does appear to be equivalent to "not(a is distinct from b)", > although I'm not sure that's necessarily easier to use than the above.
I often do things like "coalesce(a ,0) = coalesce(b,0)". (Or whatever value you know won't appear) Even simpler: COALESCE( a = b, a IS NULL AND b IS NULL )
I'm not quite sure what is being accomplished here... My original
expression wasn't that bad, just clunky. I'd prefer a === b or (a
samevalue b), but the above just complicates matters. Also, a 'set'
command outside the expression goes completely against the idea, that
certain fields have 'null' as a legal, comparable value, while others
do not.
Anyway, idle speculation :)
d.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mercuro |
last post by:
Hello
i'm looking for a simple way to checksum my data.
The data is 70 bytes long per record, so a 32
byte hex md5sum would increase the size of my
mysql db a lot.
I'm looking for something that is 5 bytes long,
for the moment i'm just taking a part of the hex
md5 sum (like this: checksum = md5sum). I
|
by: pradeep |
last post by:
I have 2 data files,
DATA1 and DATA2 , both same.
My task is to:
Open DATA1, compute the checksum and put it in the end of the
file(don't bother about boundary conditions).close DATA1
Open DATA2,compute the checksum and put it in the end(don't bother
about boundary conditions).close DATA2.
Now again open DATA1, compute the checksum of the file(leaving the
|
by: Abby |
last post by:
I have an array which contain Hex no. in each position.
For examples,
unsigned char data;
data = 0x00;
data = 0x01;
data = 0x02;
data = 0xE;
data = 0xEF; --> This is the checksum value
|
by: Abby |
last post by:
I need to do 8 bits 2's complement checksum, so I wrote code in order
to see if the checksum calculation is correct.
===========================================================================
#include <stdio.h>
int main(){
char data;
char resp;
|
by: Kevin |
last post by:
I'm on Sun 0S 5.8 and need to calculate the checksum of certain
sections in an ELF binary file. Specifically .text to .rodata. I'm
able to parse through to the program header table and then find the
section header table and then find the correct sections using the
section header string table. Using this method, I am able to find the
offset to the .text section and the number of bytes for the range of
sections i need to calculate the...
| |
by: Astroman |
last post by:
Hi guys and girls. This is my first time posting here so go easy :) .
I was wondering if someone could please interpret how this csum()
function works in the following C code. I know that the function
returns the checksum value but I was wondering How. I only included
the top half of the c code because you probably dont need the other
half and also it is a syn flooding program so I thought I shouldn't
post the whole lot. This is from the...
|
by: Andrus |
last post by:
Device connected to serial port accepts data packets in the form
02 0x57 ll ll 00 00 00 00 dd..dd cc cc
02 (1 byte ) is message prefix
0x57 (1 byte) is message type (W=Write)
ll ll ( 2 bytes) are message data length
00 00 00 00 (4 bytes) seems to be constant zero bytes
dd..dd ( ll ll bytes) is message content which I can vary.
cc cc ( 2 bytes ) is problebly message checksum
|
by: Terry |
last post by:
I'm trying to calculate the checksum for UDP packet. The algorithm itself
is not difficult (lots of examples out there), but what I'm having the most
trouble with is determining the byte order that multibyte values need to be
in. The RFC's for the IP header and UDP protocol do not specify whether the
multibyte values need to be stored in host or network byte order.
Also, the verbage of the description for constructing the pseudoheader...
|
by: gameMaker |
last post by:
I need to be able to build my code into a dll where the checksum of the dll
is the same everytime I build it. In other words, the same exact code gives
me a different checksum each time I build it.
Does anyone know why the dll would not be the same every time? Is it adding
a timestamp in the dll? If so, can I turn it off?
Thanks!
|
by: Rain |
last post by:
hi,
need help here, does anyone know how to use or does any one have the code
for checksum? I want to checksum a string to be sent using udp and checksum
it again when received.. does anyone know the code for checksum? Thanks i
would really really appreciate it. Thanks in advance..
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |