pvaneynd: (Default)
[personal profile] pvaneynd
As some of you know I'm back to coding. This morning I was trying to create a SQL table which failed with mysterious errors, like:

DB=> CREATE TABLE sequence (
 sequence_id INTEGER NOT NULL,
 guid_id INTEGER REFERENCES public.guid(id),
 sequence_number INTEGER NOT NULL);
ERROR:  relation "public.guid" does not exist
Time: 3.007 ms
DB=> \dt guid
        List of relations
 Schema | Name | Type  |  Owner
--------+------+-------+----------
 public | guid | table | pevaneyn
(1 row)


I was suspecting a hidden character, so od to the rescue:

$ od -c failing-command
...
0000140   i   d       I   N   T   E   G   E   R       R   E   F   E   R
0000160   E   N   C   E   S     357 273 277   g   u   i   d   (   i   d
...


Octal 357 273 277? Clearly this is UTF-8 encoding of something invisible. Let's use clisp:

[1]> CUSTOM:*TERMINAL-ENCODING*
#<ENCODING CHARSET:UTF-8 :UNIX>
[2]> (EXT:CONVERT-STRING-FROM-BYTES (vector #o357 #o273 #o277) CUSTOM:*TERMINAL-ENCODING*)
""
[3]> (aref (EXT:CONVERT-STRING-FROM-BYTES (vector #o357 #o273 #o277) CUSTOM:*TERMINAL-ENCODING*) 0)
#\ZERO_WIDTH_NO-BREAK_SPACE

Ok an invisible space got inserted somewhere along the line... At least I'm not getting mad and forgetting basic SQL :)
From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

Profile

pvaneynd: (Default)
pvaneynd

March 2017

S M T W T F S
   1234
567891011
12131415 161718
19202122232425
26272829 3031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 26th, 2017 06:44 pm
Powered by Dreamwidth Studios