473,511 Members | 16,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

putting binary data in a char field?

I'm attempting to use spamassassin 3.0 (beta) with an SQL backend, and have
identified one performance gain so far that makes PostgreSQL a good (IMO)
candidate for the backend. I need some advice though on another aspect--
instead of storing each token as text in the database, the token is being
sha1()'d and then possibly pack()'d.

That's all just background for my real question-- is there anything in the
standards (or elsewhere) that says you can't put binary(**) data into a char
field? When I changed the field to a bytea, processing time was
significantly reduced.

(**) Based on what very little I know of sha1 and of the tokens that have
been created by SA, it certainly looks like it's binary data that is being
inserted into the char field.

Thanks,
-ron

---------------------------(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

Nov 23 '05 #1
2 1864
Ron Snyder <sn****@roguewave.com> writes:
That's all just background for my real question-- is there anything in the
standards (or elsewhere) that says you can't put binary(**) data into a char
field? When I changed the field to a bytea, processing time was
significantly reduced.


bytea is the right thing. char will not support null (zero) bytes in
the data, and you may have character-set-encoding issues as well.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #2
Ron Snyder <sn****@roguewave.com> writes:
That's all just background for my real question-- is there anything in the
standards (or elsewhere) that says you can't put binary(**) data into a char
field? When I changed the field to a bytea, processing time was
significantly reduced.


bytea is the right thing. char will not support null (zero) bytes in
the data, and you may have character-set-encoding issues as well.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7512
by: G-Factor | last post by:
Hi all I've just started learning about saving files. I got bit of a problem. The following code gives me an error about incompatible types. (Cannot covert from class character to char *). I...
1
8734
by: Niko Korhonen | last post by:
I'm currently in the process of programming a multimedia tagging library in standard C++. However, I've stumbled across one or two unclear issues while working with the library. First of all, is...
2
2508
by: John H | last post by:
Hi , Have a Visual C++ app that use odbc to access sql server database. Doing a select to get value of binary field and bind a char to that field as follows , field in database in binary(16) ...
0
4813
by: sangui | last post by:
Helllo. this is biginner programmer. Would u check the file that I programed on c#(winform)? I tryed to make the program reading the binary file by C# programming but I failed. If u have...
0
316
by: Ron Snyder | last post by:
I'm attempting to use spamassassin 3.0 (beta) with an SQL backend, and have identified one performance gain so far that makes PostgreSQL a good (IMO) candidate for the backend. I need some advice...
6
10023
by: SandyMan | last post by:
Hi, I am able to open a binary file for reading but can someone tell me as how to go about converting a Binary file to ASCII file using C. Thanks In Advance SandyMan
3
3385
by: tracethepath | last post by:
hello everybody... i am trying to make a project on binary files and that needs a function to modify data in a binary file. I have made the following class. class example { public: ...
11
4260
by: David Mathog | last post by:
In the beginning (Kernighan & Ritchie 1978) there was fprintf, and unix write, but no fwrite. That is, no portable C method for writing binary data, only system calls which were OS specific. At...
3
5992
by: ist | last post by:
Hi, I am trying to get (and transfer over ASP.NET) some encrypted data from some MySQL fields. Since the data contains many unicode characters, I tried to get the data as a series of ASCII...
0
7138
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...
1
7081
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...
0
7510
tracyyun
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...
0
5668
agi2029
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,...
1
5066
isladogs
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...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
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...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
447
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.